In this article, we will write a program in python that will check if a string is an integer or not. We will create a function that will take a string as input and returns a Boolean value (true or false) based on the condition if it is an integer or not. We will take the input from the user and call the function. After storing the result, we will print on the console whether the string is an integer or not. If all the characters of an inputted string are between ‘0’ and ‘9’, then it means that the string is an integer. For Example: 123, It is an Integer because all the characters are between 0 and 9. 35446554667876832, It is also an Integer because all the characters are between 0 and 9 only. 234t5, It is not an Integer because it contains a character ‘t’ which is not between 0 and 9. If any character is not following the rule, then we can consider that the string is not an Integer. # Function to check if a string is Integer of Not def checkInteger(str1): """
This website is about programming knowledge. You can call this blog best programming master.