My first "serious" program written in python

in programming •  8 years ago  (edited)

Recently I started learning programming in python. After learning the command "print" and writing my first program (it was, of course, "hello world") I decided to get on with something more difficult. The result was my first simple calculator in python. Very simple. It looks like this:

While True:
a = input(" ")
a = int(a)
b = input(" ")
b = int(b)
sum = a + b
subtraction = a - b
multiplication = a * b
divisibility = a / b

result = input(" ")

if result == "+":
    print(sum)

elif result == "-":
    print(subtraction)

elif result == "*":
    print(multiplication)

elif result == "/":
    print(divisibility)

elif result == "=":
    break

input("")

To my surprise, my program works. What was your first program written in python? What are your progress in programming?

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Kasiu, dluga droga przed toba....

So, what happens when you try "5 / 0"... now fix your bug! Also, validate your input.

Congratulations @katarzyna! You have received a personal award!

Happy Birthday - 1 Year on Steemit Happy Birthday - 1 Year on Steemit
Click on the badge to view your own Board of Honor on SteemitBoard.

For more information about this award, click here

By upvoting this notification, you can help all Steemit users. Learn how here!

Congratulations @katarzyna! You have received a personal award!

2 Years on Steemit
Click on the badge to view your Board of Honor.

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Congratulations @katarzyna! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 3 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!