Could someone explain to me what does "str" mean and what does it do? Thanks! :) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Could someone explain to me what does "str" mean and what does it do? Thanks! :)

4th Apr 2016, 10:16 PM
Artūras
Artūras - avatar
2 Answers
+ 1
You can use str to type cast. and you can convert something (a float or integer) to string type. e.g. lets say you have an integer type variable ... >>> enrollment_number= 32 >>> str(enrollment_number) '32' try it on your idle. Note: vice versa isn't possible for a string type variable. because strings cannot be converted into integer or float. try this as well. >>> iLike= 'Python' >>> int(iLike) you will get an error.... >>> float(iLike) you will get an error again...... Hope this helps... Thank you and Happy Programming. :)
26th Jun 2016, 7:29 PM
Adarsh Namdev
Adarsh Namdev - avatar
0
As far as I can tell, it converts one variable of any type into a string.
11th Apr 2016, 12:26 AM
Jw.