Jan-17-2018, 11:49 PM
Call ticket_check() function with 2 arguments: section and seats requested and return True or False
section is a string and expects: general, floor
seats is an integer and expects: 1 - 10
Check for valid section and seats
if section is general (or use startswith "g")
if seats is 1-10 return True
if section is floor (or use starts with "f")
if seats is 1-4 return True
otherwise return False
# [ ] create and call ticket_check()
my code:
Do not understand this, what did I do wrong?
section is a string and expects: general, floor
seats is an integer and expects: 1 - 10
Check for valid section and seats
if section is general (or use startswith "g")
if seats is 1-10 return True
if section is floor (or use starts with "f")
if seats is 1-4 return True
otherwise return False
# [ ] create and call ticket_check()
my code:
def ticket_check(section, seats): if section == "general": if 0 < seats < 11: return True elif section == "floor": if 0 < seats < 5: return True else: return False sct = input("add section: ") sts = input("add seats: ") ticket_check(int(sct), str(sts))I receive ValueError: Invalid literal for int() with base 10: 'general'
Do not understand this, what did I do wrong?
