コード例 #1
0
def get_lastname():

    lastname = ""
    lastblank = test.is_field_blank(lastname)
    while lastblank:  #repeat this loop until we get a last name
        lastname = input("Please enter your last name: ")
        lastblank = test.is_field_blank(lastname)
        if lastblank:
            print("You must enter a last name.")
            print()
    return lastname  #send verified last name input back to main
コード例 #2
0
def get_firstname():

    firstname = ""
    firstblank = test.is_field_blank(firstname)
    while firstblank:  #repeat this loop until we get a first name
        firstname = input("Please enter your first name: ")
        firstblank = test.is_field_blank(firstname)
        if firstblank:
            print("You must enter a first name.")
            print()
    return firstname  #send verified first name input back to main
コード例 #3
0
def get_lastname():

    lastname = ""
    lastblank = test.is_field_blank(lastname)
    print("lastblank " + str(lastblank))
    while lastblank:
        lastname = input("Please enter your last name: ")
        lastblank = test.is_field_blank(lastname)
        if lastblank:
            print("You must enter a last name.")
            print()
    return lastname
コード例 #4
0
def get_firstname():

    firstname = ""
    firstblank = test.is_field_blank(firstname)
    print("firstblank " + str(firstblank))
    while firstblank:
        firstname = input("Please enter your first name: ")
        firstblank = test.is_field_blank(firstname)
        if firstblank:
            print("You must enter a first name.")
            print()
    return firstname
コード例 #5
0
def get_age():

    age = ""
    ageblank = test.is_field_blank(age)
    agetest = test.is_field_a_number(age)
    while ageblank == True or agetest == False:  #repeat this loop until we get a non-blank numeric input
        age = input("Please enter your age: ")
        ageblank = test.is_field_blank(age)
        agetest = test.is_field_a_number(age)
        if ageblank == True:
            print("You must enter an age.")
            print()
        elif agetest == False:
            print("You must enter a numeric age.")
            print()
    return age  #send verified age value back to main
コード例 #6
0
def get_age():

    age = ""
    ageblank = test.is_field_blank(age)
    agetest = test.is_field_a_number(age)
    print("ageblank " + str(ageblank))
    print("agetest " + str(agetest))
    while ageblank == True or agetest == False:
        age = input("Please enter your age: ")
        ageblank = test.is_field_blank(age)
        agetest = test.is_field_a_number(age)

        if ageblank == True:
            print("You must enter an age.")
            print()
        if agetest == False:
            print("You must enter a numeric age.")
            print()
    return age
コード例 #7
0
ファイル: Eilers_asgn4.py プロジェクト: scuttlebugg/CSIT_175
def getFirstName():
    """
    accepts no arguments
    returns a string for user first name
    """
    blank = True
    while blank == True:
        string = input("\nWhat is your first name? ")
        blank = module.is_field_blank(string)
        if blank == True:
            print("First name must be entered. ")
        else:
            return string
コード例 #8
0
ファイル: Eilers_asgn4.py プロジェクト: scuttlebugg/CSIT_175
def getAge():
    """
    accepts no arguments
    returns a integer value for user age input
    """
    blank = True
    while blank == True:
        number = input("\nWhat is your age? ")
        blank = module.is_field_blank(number)
        if blank == True:
            print("Age must be entered. ")

    num = False
    while num == False:
        num = module.is_field_a_number(number)
        if num == False:
            print("Age must be a number. ")
            number = input("\nWhat is your age? ")
        else:
            return int(number)