Respuesta :
Answer:
Following are the program in the Python Programming Language:
def check(num): #define function
if(num.isdigit()): #set if statement
return "yes"; #return yes if condition is true
else:
return "no";# return no if condition is false
string=input("Enter the numbers 0-9: ") #get input from the user
print(check(string)) #print and call the function
Output:
Enter the numbers 0-9: 1995
yes
Enter the numbers 0-9: 42,000
no
Explanation:
Here, we define a function "check()" and pass an argument in its parameter "num" inside the function.
- we set if-else conditional statement and check the value stored in the variable "num" is the digit by using built in function "isdigit()" then return "yes".
- Then, otherwise it return "no".
Finally, we get the input from the user in the variable "string" then, we call the function through "print()" function.
The program illustrates the use of strings and string manipulations.
String manipulations involve carrying several operations and tests on a string.
The required program, where comments are used to explain each line is as follows:
#This gets input from the user
userInput=input("User input: ")
#This checks if the input contains only integer
if(userInput.isdigit()):
#If yes, the program prints "yes"
print("yes")
else:
#If otherwise, the program prints "no"
print("no")
The program tests the user input, and prints the appropriate output string.
See attachment for the complete program and the sample run
Read more about similar programs at:
https://brainly.com/question/24725082