Can we use str.isdigit() and str.isalpha() without importing any library or modules? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can we use str.isdigit() and str.isalpha() without importing any library or modules?

input_1 = input() calc = input_1.split() print(calc[0]) calc[0].isdigit() This prints only the value of calc[0]. Not printing True or False. Why is this code not returning whether calc[0] is a digit or not?

27th Oct 2021, 3:57 AM
Neethu Nath
Neethu Nath - avatar
1 Answer
+ 4
It works without importing anything, it needs just a print statement: calc = input().split() print(calc[0]) print(calc[0].isdigit())
27th Oct 2021, 4:23 AM
Paul
Paul - avatar