## Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today. # Python Calculator program help!!!

Hi, I am a very new python programmer. I decided to make this simple calculator and after just adding some new features and working on it the use a new number function is not working anymore. I would love feedback about the program Thank you so much

import sys import math print("---- WELCOME TO CALCULATOR!----")

counter2 = -1 counter1 = 0 counter3 = 1 while counter1 == 0:

```    try:
num1 = float(input("Enter a number: \n"))
except ValueError:
print("Oops! Invalid number...")
else:
print("Valid number!\n")
counter2 += 1

while counter3 == 1:
operation = str(input(
'Pick option: \n A)Addition \n S)Subtraction \n D)Division \n M)Multiplication \n R)Root \n'
' E)Exponent \n P)Percantage \n'))
if operation == "A":
print("Valid input!")
counter2 = 0
counter3 = 0
elif operation == "S":
print("Valid input!")
counter2 = 0
counter3 = 0
elif operation == "D":
print("Valid input!")
counter2 = 0
counter3 = 0
elif operation == "M":
print("Valid input!")
counter2 = 0
counter3 = 0
elif operation == "R":
print("Valid input!")
counter2 = 0
counter3 = 0
elif operation == "E":
print("Valid input")
counter2 = 0
counter3 = 0
elif operation == "P":
print("Valid input")
counter2 = 0
counter3 = 0
else:
counter2 = 1

while counter2 == 0:

if counter3 == 0:
try:
num2 = float(input("Enter another number: \n"))
except ValueError:
print("Oops! Invalid number...")
counter2 = 0
else:
print("Valid number!\n")
counter2 = 1

while counter2 == 1:

if operation == "A":
result = num1 + num2
print("{} + {} = {}".format(num1, num2, round(result, 14)))
counter2 += 1

elif operation == "S":
result = num1 + num2
print("{} - {} = {}".format(num1, num2, round(result, 14)))
counter2 += 1
elif operation == "D":
result = num1 / num2
print("{} / {} = {}".format(num1, num2, round(result, 14)))
counter2 += 1
elif operation == "M":
result = num1 * num2
print("{} * {} = {}".format(num1, num2, round(result, 14)))
counter2 += 1
elif operation == "R":
result = num1 ** (1/num2)
print("The {} root of {} = {}".format(num2, num1, round(result, 14)))
counter2 += 1
elif operation == "E":
result = num1 ** num2
print("{} to the power of {} = {}".format(num1, num2, round(result, 14)))
counter2 += 1
elif operation == "P":
result = num1 / 100 * num2
print("{}% of {} = {}".format(num1, num2, rount(result, 14)))
counter2 += 1
else:
print("Invalid! check if the letter you entered is a capital")

while counter2 == 2:
try:
options = int(input("Choose option: \n 1)leave \n 2)Use a new number \n 3)Do a new equation \n"))
except ValueError:
print("Oops! Invalid number...")
else:
if options == 2:
print("Alright")
try:
num2 = float(input("Enter the new number you want to use : \n"))
except ValueError:
print("Oops! Invalid number...")
else:
print("Valid number!\n")
counter2 = 0
counter1 = 2
counter3 = 1
num1 = round(result, 14)
elif options == 3:
print("Alright")
counter1 = 0
counter2 = -1
counter3 = 1
else:
sys.exit()
```