The program needs to output the numbers 1 to 9, each on a separate line, followed by a dot: 1. 2. 3. ... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 4

The program needs to output the numbers 1 to 9, each on a separate line, followed by a dot: 1. 2. 3. ...

Answer please

20th May 2021, 12:54 PM
BellamkondaPriyanka
BellamkondaPriyanka - avatar
4 Answers
0
You should tell which programming language you need. If you are using Python, you can try this: for i in range(1, 10): print(f"{i}.") Explanation: The "for" loop does the thing in the next line for every item in specified list,string,... , and it uses i (whatever you type after "for") as a variable Range creates a list of numbers between 1 and 10 ( 10 isnt counted) "print" will print the thing in (). And the f before the string ("{i}.") lets you modify the thing in {}
20th May 2021, 1:05 PM
Gašper Koželj
Gašper Koželj - avatar
- 1
Hi! Fo better help to you, please, show us your code attempt! Thx!
20th May 2021, 1:03 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
- 1
for i in range(1, 10): print(i,'.', sep='')
21st May 2021, 12:21 PM
Vaibhav Mandloi
Vaibhav Mandloi - avatar
- 5
You're almost done with your beginners course (python). This is the fundamental concept.. Better go through the course again...!! Hint :- It's all about print() and \n (newline) (or) loop
20th May 2021, 1:03 PM
sarada lakshmi
sarada lakshmi - avatar