How to do integer in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to do integer in python

31st Jul 2020, 7:36 AM
Lipi Gupta
Lipi Gupta - avatar
3 Answers
+ 11
Please post your code here, or make some sample data that makes your question better understandable. Thanks!
31st Jul 2020, 9:58 AM
Lothar
Lothar - avatar
+ 10
I don't think so that you have this doubt but: To convert a string to integers, simply use int() function: a="4" print(int(a)) #It will be converted to integer. Others also are: str() #for conversion to a string. #and float() #For conversion to a float. However, it's already explained in the lesson itself. Just go through it.
31st Jul 2020, 7:48 AM
Arctic Fox
Arctic Fox - avatar
+ 7
answer = 42 python knows that 42 is an integer.
31st Jul 2020, 7:44 AM
Oma Falk
Oma Falk - avatar