You are on page 1of 2

'''

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 = eval(input("How many sources? "))


sum = 0
while x > 0:
y = eval(input("How much money? "))
sum = sum + y
x=x-1

print("The total is",sum)

x = eval(input("Enter the amount of money or (0 to stop): "))


sum = 0
while x != 0:
sum = sum + x
x = eval(input("Enter the amount of money or (0 to stop): "))

print("The total is",sum)

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):")

print("The total is", sum)

x = eval(input("How many sources? "))


count = 0
sum = 0

while x > 0:
count = count + 1
y = eval(input("How much money? "))
sum = sum + y
x=x-1

print("The total is",sum)


print("The avrage is", sum / count)

'''
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): "))

print("The total is",sum)


print("The avrage is", sum/count)

You might also like