- 1
You need to make a program for a leaderboard. The program needs to output the numbers 1 to 9, each on a separate line,
Can anyone help , Output must be 1. 2. 3. 4. . . 9.
3 Antworten
0
for i in range(1, 10):
print(i)
0
C#
int i = 1;
while(i <= 9){
Console.WriteLine(i);
i++;
}
}
0
here is an example with some explanation of the code that might work.
def leaderboard(n):
# function to loop through range and print each line one by one
for x in range(n): # loop range
string=f"{x+1}." # create string
print(string) # print leaderboard line
if __name__=="__main__":
x=10 # number for leaderboard
leaderboard(x) # run leaderboard function
https://code.sololearn.com/cPWiAycA5jLK/?ref=app
edit:
i am created a function, but thats not really needed. this is just one way to write it.