Created
May 28, 2020 00:02
-
-
Save TFlexSoom/b10b3ce55596ecdb8ea8260cd6d7bbe7 to your computer and use it in GitHub Desktop.
Assignment For Sorting, Lists, and Looping
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| We have a guessing game. I want you to do the following. | |
| - Collect all the answers into a list | |
| - Rank the answers to how close they were to the number | |
| This means | |
| - Grabbing the absolute difference of each guess and the answer | |
| - putting them into a list | |
| - sorting the list either through the standard library or some algorithm | |
| """ | |
| answer = random.randint(1, 100) | |
| guess = 0 | |
| while guess != answer: | |
| guess = int(input("Guess a number between 1 and 100")) | |
| if guess < answer: | |
| print("Too Low!") | |
| elif guess > answer: | |
| print("Too High!") | |
| print("You got it right!") | |
| print("Here are your answers!") | |
| # Print your rankings here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment