akosiraff

Download GuessMyNumber_Week5

Feb 14th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1.  
  2. Download: https://solutionzip.com/downloads/guessmynumber_week5/
  3. Guess the Number Week 5
  4. You will add to the program you created in Week 4. This week you will add input validation and a count to show how many guesses the user took before getting the correct number. Be sure to import random at the beginning of your code and use a comment block explaining what your program does.
  5. Pseudocode:
  6. #Guess the number week 5
  7. #Name:
  8. #Date:
  9. #Random number, loop while true
  10. #ask user for number. Check to see if the value is a number between 1 and 10
  11. #if number is too high or too low, tell user, if they guessed it break out of loop
  12. Display “Welcome to my Guess the number program!”
  13. random mynumber
  14. count=1
  15. while True
  16. try
  17. Display “Guess a number between 1 and 10”
  18. Get guess
  19. while guess<1 or guess>10
  20. Display “Guess a number between 1 and 10”
  21. Get guess
  22. except
  23. Display “numbers only”
  24. continue
  25. if (guessmynumber)
  26. Display “Too high”
  27. count=count+1
  28. else if (guess==mynumber)
  29. Display “You guessed it in “+ count + ” attempts”
  30. Expected Result of Program:
  31.  
  32. Download: https://solutionzip.com/downloads/guessmynumber_week5/
Add Comment
Please, Sign In to add comment