How to convert string into integer in Python?

All QuestionsCategory: PythonHow to convert string into integer in Python?
Chetan Shidling asked 4 years ago

I need short information.

1 Answers
chetan shidling answered 4 years ago

By using this code you can convert string type value into integer.
a = int(x)
Where, x is string which i am converting to integer.
 
Let’s see one example.
 
x = input(“Enter 1st number”)
a = int(x)
y = input(“Enter 2nd number”)
b = int(y)
z = a + b
print(z)
 
By using this,
a = int(x)
b = int(y)
You can convert string value into integer.