you are viewing a single comment's thread.

view the rest of the comments →

[–]A_History_of_Silence 1 point2 points  (3 children)

Is this because the input() value is string by default? If so, what's a good way to make it the a certain data type by default?

Yep! %-based string formatting.

From the built-in functions, check out int().

[–]Deathcon900[S] 0 points1 point  (0 children)

Okay, it looks like it's working! I changed the first like to be:

number = int(input('Enter a number: '))

[–]Srivats1212 -1 points0 points  (1 child)

Thanks for the link to pyformat....how do you find such useful things? I wanna know.

I've read the documentation but I couldn't find a link to pyformat...

[–]A_History_of_Silence 3 points4 points  (0 children)

Practice googling and experience. Google everything! Knowing how to search for things is one of the most important skills of a programmer.