Professional Documents
Culture Documents
import random
number = random.randint(0, 100)
print("Guess a magic number between 0 and 100")
guess = -1
while guess != number:
guess = eval(input("Enter your guess: "))
if guess == number:
print("Yes, the number is", number)
elif guess > number:
print("Your guess is too high. Go smaller")
else:
print("Your guess is too low. Go bigger")
x = "yes"
sum = 0
while x =="yes":
y = eval(input("Enter the money: "))
sum = sum + y
x = input("To add money, Enter yes or (no to stop):")
while x > 0:
count = count + 1
y = eval(input("How much money? "))
sum = sum + y
x=x-1
'''
x = eval(input("Enter the amount of money or (0 to stop): "))
sum = 0
count = 0
while x != 0:
count = count + 1
sum = sum + x
x = eval(input("Enter the amount of money or (0 to stop): "))