Anaconda Python 3.7Create a function that guesses the number a use.docx

  • No School
  • AA 1
  • 4

This preview shows page 1 - 3 out of 4 pages.

Image of page 1

Subscribe to view the full document.

Anaconda Python 3.7 Create a function that guesses the number a user randomly chooses. The function should solicit feedback from the user. Use the built-in "input()" function for this. Problem 2 Create a function that guesses the number a user randomly chooses. The function should solicit feedback from the user. Use the built-in input() function for this. For example: In [ ]: number = int(input('Please enter a number.')) Here's how the function should work. First, the user will choose a positive integer in their head from 1 to 100,000. Then, your function will be called. Your function will start with an initial guess, asking the user if this guess is correct. If it is, the program is done. If it's not, your function should ask a question about this number. Perhaps it's a greater than question. Maybe it's an odd/even question. Based on the feedback from this question, re-adjust your guess. Then, ask the user if your guess is correct. Continue with question / validation until you've guessed the number correctly. The goal is to guess the user's
Image of page 2
Image of page 3
  • Fall '19
  • Natural number, initial guess

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