0

I am writing a python code to generate a contract when particular fields are filled the date field accepts any data instead of dd/mm/yyyy. I want an error message to be generated when an incorrect value is entered and until the right format is entered, the user cannot jump to the next field.

print("Hello, Welcome to Rent contract generator!")
def get():
    first = input("Enter your name: ")
    last = input("Enter your last name: ")
    bday = input("Enter your birthday (dd/mm/yyyy): ")
    address = input("Enter your address: ")
    userid = input("Enter your ID number: ")

    inputdata = (first, last, bday, address, userid)
    print("Hello " + first + "! " + "Your rental contract is ready now :)")
    
    return inputdata````
mengot gg
  • 1
  • 1
  • the term `field` is not clear. can you show your code? – diggusbickus Dec 14 '21 at 10:12
  • # 1. get user input print("Hello, Welcome to Rent contract generator!") def get(): first = input("Enter your name: ") last = input("Enter your last name: ") bday = input("Enter your birthday (dd/mm/yyyy): ") address = input("Enter your address: ") userid = input("Enter your ID number: ") – mengot gg Dec 14 '21 at 17:45
  • To validate a date format, please have a look at already given answers here : https://stackoverflow.com/questions/16870663/how-do-i-validate-a-date-string-format-in-python – Malo Dec 21 '21 at 10:12

0 Answers0