Given a string, check if it contains only digits. Using Python
Posted on | Wednesday, 17 May 2023 | No Comments
Given a string, check if it contains only digits.
Input Format
Input contains a string S, consisting of ascii characters.
Constraints
1 <= len(S) <= 100
Output Format
Print "Yes" if string contains only digits, "No" otherwise.
Sample Input 0
123456786543
Sample Output 0
Yes
g=input()
if g.isnumeric():
print("Yes")
else:
print("No")

Comments
Categories
Archives
- May 2023 (30)
Leave a Reply