- 1
Hi i have this problem in python for beginners.
You need to make a program for a leaderboard. The program needs to output the numbers 1 to 9, each on a separate line, followed by a dot: 1. 2. 3. ...
5 odpowiedzi
+ 3
Mahammad Qasm
You need to convert int to string and concatenate with dot (.)
print function bydefault add new line.
Just do this
for i in range(1, 10):
print(str(i) + ".")
+ 3
Nazeekk
Your loop code will give error since you can't join number with string like that so you need to convert int to string
And also print function bydefault add new line so no need to add \n
0
Weird question😳
Try this:
print("1.\n2.\n3.\n4.\n5.\n6.\n7.\n8.\n9.\n")
0
Or this:
for i in range(9):
print(i + ".\n")
0
Thanks the problem solved