- 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. ...

6th Feb 2021, 12:24 PM
Mahammad Qasm
Mahammad Qasm - avatar
5 Antworten
+ 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) + ".")
6th Feb 2021, 12:39 PM
A͢J
A͢J - avatar
+ 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
6th Feb 2021, 12:43 PM
A͢J
A͢J - avatar
0
Weird question😳 Try this: print("1.\n2.\n3.\n4.\n5.\n6.\n7.\n8.\n9.\n")
6th Feb 2021, 12:27 PM
Nazeekk
Nazeekk - avatar
0
Or this: for i in range(9): print(i + ".\n")
6th Feb 2021, 12:28 PM
Nazeekk
Nazeekk - avatar
0
Thanks the problem solved
6th Feb 2021, 12:50 PM
Mahammad Qasm
Mahammad Qasm - avatar