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....
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
So, what happens when you try "5 / 0"... now fix your bug! Also, validate your input.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
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
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations @katarzyna! You have received a personal award!
2 Years on Steemit
Click on the badge to view your Board of Honor.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
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!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit