0
Forgot what certain commands did in python 3
Hey, so I saw a ton of commands being used in the lessons and I completely forgot what they did. Could someone please tell me what "str", "int", "+=", and "!e" do?
1 Réponse
+ 2
str is a built-in function in python which is use to convert int or something into string.e.g
x=3
print(str(x)) #now x is str not int.
int is built in function in python which is use to convert string digit into int.e.g
x='3'
print(int(x)) #now x is int not a string.
+=
it is just a shortcut for adding two something. e.g
x=1
for m in range(1,3):
x+=m
#it is equal to
x=x+m
so it is just a shortcut.
you can also check here.
https://data-flair.training/blogs/python-operator/