My first "serious" program written in python

in #programming8 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?

Sort:  

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!

Coin Marketplace

STEEM 0.16
TRX 0.12
JST 0.027
BTC 53933.04
ETH 2871.02
USDT 1.00
SBD 2.00