My first "serious" program written in python
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?
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
Congratulations @katarzyna! You have received a personal award!
2 Years on Steemit
Click on the badge to view your Board of Honor.
Congratulations @katarzyna! You received a personal award!
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!