Python Forum
Decision statement problems
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Decision statement problems
#3
You want to do something when it is not a digit
def is_it_digit(inptUser):
    for x in inptUser:
        if not x.isdigit():
            print('a not digit found')
            return False
    print(' The input is full of digits ')
    return True

inptUser = input('Please enter a variable : ')
print(inptUser)
print(is_it_digit(inptUser)) 
And when you have some time, take a look at the Python Style Guide; variables are lower_case_with_underscores
https://www.python.org/dev/peps/pep-0008/
Reply


Messages In This Thread
Decision statement problems - by erfanakbari1 - Mar-04-2019, 07:10 PM
RE: Decision statement problems - by ichabod801 - Mar-04-2019, 08:44 PM
RE: Decision statement problems - by woooee - Mar-06-2019, 12:27 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Using ID3 Estimator for Decision Trees student6306 2 1,391 Jun-15-2023, 04:11 PM
Last Post: student6306
  What's the full answer to this question in python? (bayesian decision theory) Hblaugrana 1 2,483 Oct-31-2018, 02:22 PM
Last Post: j.crater

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020