why do we use str function? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

why do we use str function?

15th Aug 2020, 2:09 PM
Hemaprabha S
Hemaprabha S - avatar
1 Answer
0
Hey There Hemaprabha S We Having 3 Main Data-types In Python- 1. Integer(Includes Whole Numbers) 2. Floating Point(Numbers With Decimals) 3. String(Sequence Of Characters) If We Talk About String Then Strings Are Immutable In Nature It Means After Initialising You Can’t Make Changes In Your String But You Can Perform Concatenation. And Yes We Use str() Function To convert any datatype like integer,floating point to string datatype. x=92 print(str(x)) That str() function will print your value of x as string.
15th Aug 2020, 4:04 PM
Rahul Saxena
Rahul Saxena - avatar