Python Program - Convert String to Integer

by matt392 in Circuits > Software

85 Views, 1 Favorites, 0 Comments

Python Program - Convert String to Integer

StringToInt.png
pythonlogo.jpg
HEAD_Desktop_Strings_Landing_Page_06_Moodfilm_02.jpg
integers-2-728.jpg

# Program that will convert string to integer

print ("This program will convert a string to an integer.")

enteredstring = input("Please enter a number to be converted: ")
convertedstring = int(enteredstring)

print ("The string that was converted to an integer is:", convertedstring)

print ("The variable type of \"convertedstring\" is:", type(convertedstring) )