Jump to content
  • Advertisement

Why its wrong?

This topic is 382 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello I am a beginner in programmin. I just begun with Python.

I write a code, but python say "syntax invalid". I use python 3.6.3 and my system is mac.

My code: print("Hello, this is a calculator. ")
print("Here you can calculate any numbers you need.")
# Here I describe for the user, what the program can do.
num_1 = input("Write the first number: ")
# Here user write the first number for calculating.
num_2 = input("Write the second number: ")
# Here user write the second number for calculating.
operator = input("Write the matematic operator you need: ")
# Here the user write the matematic opertator they neee.
if operator == '+':
    print(int(num_1) + (int(num_2))
elif operator == '/':
    print(int(num_1) / (int(num_2))
elif operator == '-':
    print(int(num_1) - (int(num_2))
elif operator == '*':
    print(int(num_1) * (int(num_2))
elif operator == '%':
    print(float(num_1) % (float(num_2))
elif operator == '**':
    print(int(num_1) ** (int(num_2))
print("Thank you dear user! ")




Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!