when should I use the str() method?? plz help... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

when should I use the str() method?? plz help...

2nd Nov 2016, 5:27 AM
Sonnet Saif
Sonnet Saif - avatar
3 Answers
+ 3
str () is a function which is used for converting any data type like ING, FLOAT etc to string. So whenever you want to change the data type of any to string use str ().
2nd Nov 2016, 5:57 AM
Waqas Asghar Bhalli
Waqas Asghar Bhalli - avatar
+ 2
If I remember correctly str() changes anything to a string. Same as int(). Now I will leave it up to you to find where it might be useful. You learn more by actually programming. When you do something think of how you will do it. What is the fastest and most readable way to do it. And perhaps you will find ways which you never thought of.
2nd Nov 2016, 5:53 AM
nedas
nedas - avatar
0
you should read about data structures int. str. float. #basic structures int can be converted to str int can be converted to float #viceversa but but but str cannot be converted to int
2nd Nov 2016, 4:12 PM
Anas Aijaz
Anas Aijaz - avatar