# number guessing game
import random
# random numbers from 1 to 100
secret_number = random.randint(1, 100)
# your guess
guess = 0
# number of guess
tries = 0
max_tries = 7
print("Welcome to the number guessing game.")
print("I am thinking of a number between 1 and 100.")
print("I will give " + str(max_tries) + " tries to get it. Good luck!")
while (guess != secret_number) and (tries < max_tries):
guess = int(input("What is your guess? "))
if guess > secret_number:
print("That is too HIGH.")
elif guess < secret_number:
print("That is too LOW.")
tries = tries + 1
if guess == secret_number:
print("You guessed my number!")
print("##############################")
print(" Congratulations! ")
print("##############################")
else:
print("Better luck next time")
print("The secret number was", secret_number)
Reference:
https://youtu.be/7CTONNO6YMc
The Financial Journal is a blog for all financial industry professionals. This blog has been, and always will be, interactive, intellectually stimulating, and open platform for all readers.
AdSense
Subscribe to:
Post Comments (Atom)
Deep Learning (Regression, Multiple Features/Explanatory Variables, Supervised Learning): Impelementation and Showing Biases and Weights
Deep Learning (Regression, Multiple Features/Explanatory Variables, Supervised Learning): Impelementation and Showing Biases and Weights ...
-
Black-Litterman Portfolio Optimization with Python This is a very basic introduction of the Black-Litterman portfolio optimization with t...
-
0_MacOS_Python_setup_for_Quandl.txt # Go to: https://www.quandl.com/ # Sign up / in with your email address and password # Run Termina...
-
This is a great paper to understand having and applying principles to day-to-day business and personal lives. If you do not have your own ...
No comments:
Post a Comment