Conditionals: The Richter_Scale_YI.py Flowchart

Write a new program, guess_num_YI.py based on guess.py but without the “break” instruction. This program plays the game of “guess the number” as follows: Your program chooses the number to be guessed by selecting an integer at random in the range 1 to 1000. The program then displays:

I have a number between 1 and 1000.
      Can you guess my number?
      Please type your first guess.

The player then types a first guess. The program responds with one of the following:

 1. Excellent! You guessed the number! You guessed in 4 tries.
       Would you like to play again (y/n)?
    2. Too low. Try again.
    3. Too high. Try again.

If the player’s is incorrect, your program should loop until the player finally gets the number right. Your program should keep telling the player Too high or Too low to help the player “zero in” on the correct answer. After a game ends, the program should report the number of games the player played and prompt the user to enter “y” to play again or “n” to exit the game.

Random numbers:

###################################################################
# Mrs. Elia
# 10/21
# python 3.7
# Description: How to generate pseudorandom numbers
#
###################################################################

import random

yesNo = input("would you like a random number?y/n ")

while yesNo == "y":
    print (random.randrange(1,7))
    yesNo = input("would you like a random number?y/n ")
print ("goodbye")

##>>>
##would you like a random number?y/n y
##5
##would you like a random number?y/n y
##4
##would you like a random number?y/n y
##3
##would you like a random number?y/n

 

For next assignment search in the internet for the Richter magnitude scale and write a program, RichterScale_YI.py that prompts for the number scale and prints the description of the earthquake intensity: micro, minor, light, moderate, strong, major and great. Use nested if/else statements.

The flowchart for the Richter_Scale_YI.py assignment – Use google docs: drawing or draw.io

flowchart-1

lowchartup