How to convert any user input (like numbers, letters, words, names, alphabet etc) into a string in Python ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to convert any user input (like numbers, letters, words, names, alphabet etc) into a string in Python ??

String conversion ??

10th Oct 2020, 1:37 PM
Lakshya Mittal
Lakshya Mittal - avatar
2 Answers
+ 4
Lakshya Mittal , you don't need to convert anything to string when using input(). this function returns everything you enter as a string by default.
10th Oct 2020, 3:59 PM
Lothar
Lothar - avatar
+ 5
a = input() #type anything (int, float, char, ect) print(type(a)) input() defaults to a string automatically
10th Oct 2020, 1:43 PM
Slick
Slick - avatar