- 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
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 {}
- 1
Hi! Fo better help to you, please, show us your code attempt! Thx!
- 1
for i in range(1, 10):
print(i,'.', sep='')
- 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