HW3.py - #= Purpose Tells us how the dog will sound base on...

This preview shows page 1 - 2 out of 2 pages.

#========================================= # Purpose: Tells us how the dog will sound base on their size # Input Parameter(s): an integer of the dogs weight # Return Value(s): The sound the dog makes via their weight #========================================== def sound(weight): if weight < 13: return 'Yip' elif weight >= 13 and weight <=30: return 'Ruff' elif weight >= 31 and weight <=70: return 'Bark' elif weight > 70: return 'Boof' else: return 'error' #========================================== # Purpose: Shows the person there options and lets them make their won decision # Input Parameter(s): words, text, option1, option2, option3 # Return Value(s): The number they picked #========================================== def choice(text,option1,option2,option3): print(text) print('1.', option1) print('2.', option2) print('3.', option3) n = input('Choose 1, 2, or 3:') while n != 0: if n =='1': return 1 elif n=='2': return 2 elif n=='3': return 3 else: print('Invalid option') n = input('Choose 1, 2, or 3:') continue #========================================== # Purpose: Make a story # Input Parameter(s): words, text, option1, option2, option3, and numbers # Return Value(s): The number they picked and if it leads to a Good ending or bad ending #========================================== def adventure(): choice1 = choice('You have a test tommorow. What should you do?','You should party!','You should study!','You should do nothing.')
Image of page 1

Subscribe to view the full document.

Image of page 2
  • Fall '19

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes