+ 1
please
Can someone teach me this lesson? i still can't get it. thanks
2 Réponses
+ 4
type-conversion is used to change strings to integers/floats or change floats/integers to strings.
Why use this?
reason 1) to change user input (wich is a string) to numbers.
reason 2) being able to add numbers to strings to didplay them. for instance if you want to display a score.
Hoe to use?
str (number) # makes a string of everything inside ()
int (string or float) # makes integer of everything inside ()
float (str or integer) #makes float of everythin in ()
0
To see other types in Python 3.6 go to https://docs.python.org/3/library/stdtypes.html