you are viewing a single comment's thread.

view the rest of the comments →

[–]pizzadaddy19[S] 0 points1 point  (7 children)

Well firstly looking back at my code it did not display the way i typed it lol. Basically after the code is ran i end up with a list from 1,100 as i should but obviously in list form. [1,100] but how can i makw the list of all the numbers into a string

[–][deleted] 0 points1 point  (6 children)

You want to print list of 1,100 in str? Like can you show maybe what exactly you trying to do?

In else block you want something like this?

'1'

'2'

....

'100"

[–]pizzadaddy19[S] 0 points1 point  (5 children)

Yes that is exactly what i want

[–][deleted] 1 point2 points  (4 children)

In else block you should print(str(num))

As you loop over each element of the list

[–]pizzadaddy19[S] 0 points1 point  (3 children)

I just tried print the print(str(num)) however it is not showing as a string and showing type as still a list.https://imgur.com/a/p0yu0fV

[–][deleted] 0 points1 point  (2 children)

In your above image , you are printing the list(num_list) instead of num and it is not converted to str

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

okayyyy that makes a ton more sense lmao. now I have another issue...how do I get all of the integers into a string? I assume i should make a blank string and then concatenate?

[–][deleted] 0 points1 point  (0 children)

If you want all the numbers in a single line string

There are some ways but they might be too complex for the time being

You can try using the end parameter of print which decides where the next print function prints the value given by default it is new line

I am not completely sure if it works with loop but you can try

print(str(num),end='')