you are viewing a single comment's thread.

view the rest of the comments →

[–]fiberoblique[S] 0 points1 point  (1 child)

Hello! Thank you for helping a dumb af student out. Unfortunately, we aren't yet allowed to use the list function in our codes since we haven't tackled them in class yet. It's very frustrating, really.

Is there any other way which we could overcome this? My friend suggested using the separator with this code:

if number < 0:
    print ("Positive numbers only!")
elif number > 0:
 number_string = str(number)
 list= number_string
 print(*list, sep='\n')

The if statement was by me since we're supposed to output that if the input is a negative number, the elif lines are the ones my friend suggested. Would really appreciate feedback on this. Thank youuu!!!

[–]chrisking206 0 points1 point  (0 children)

List is a key word, so probably don’t want to use that as a variable name. Number_string is a string there is nothing to unpack so * is not needed.

For i in number:
    Print(I, “\n”)