Popular Posts

Tuesday, August 18, 2020

Python Beginner: Building a Basic Calculator

 Hello, Developer!

 How are you? Hope you're enjoying the Python coding! :)

So far, you have learned "print", "variables", "input" commands of Python.


Today, we will learn to build a basic calculator using these commands.

We will get two numbers from the user and add these numbers and show the adding result. 

Let's coding now! 

We used float() function for enabling decimal number adding. You can use it as the same way of int() function.


float(variable or number)

num1 = input("ENter a number: ")
num2 = input("Enter another number: ")
result = float(num1) + float(num2)

print(result)

The result showed as following

Can you see the same result? Good job!

If you have more time for exercise, let's make another simple calculator using +, -, *, / operators.

All good? See you next post! :)


15 comments:

  1. Thank you for taking the time to post this blog. I am pleased with your work after reading this post. This is very useful for us. Keep sharing such blogs. python coding course

    ReplyDelete
  2. You have shared a nice article here about the PYTHON CODING. Your article is very informative and nicely describes the causes and natural remedies of Snoring. I am thankful to you for sharing this article here.python coding course for kids

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. I really appreciate your work which you have shared here about the Education. The article you have shared here is very informative and the points you have mentioned are very helpful. Thank you so much.Thesis Writing Site.

    ReplyDelete
  5. Nice blog and absolutely outstanding. You can do something much better but i still say this perfect.Keep trying for the best. mobile app development company SLC

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. The timber framed device got here with wires into which beads have been to be assembled for calculation functions.trigonometry calculator

    ReplyDelete
  8. Home stagers can distinguish a home's style and decide a plan intelligent to that specific style without over driving the plan.hollywood hills real estate

    ReplyDelete
  9. A property venture is probably going to be held for a long time and the engaging quality of a given area might change over the holding time frame, to improve things or more regrettable. harvard condos

    ReplyDelete
  10. I’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article... building ocean one For Sale

    ReplyDelete
  11. views buy To some people, YouTube is a simple, yet the largest, video sharing website, which serves as an entertainment platform for them as well as gives them a chance to learn new things by watching informative "How To" videos. Others see it as a social channel translated into 43 languages and working with more than 15,000 advertising partners the world over, which can very well be applied for the promotion of a business. All you have to do is upload a couple of videos directly or directly related to your business and find ways to increase your profits from your YouTube viewership.

    ReplyDelete
  12. I would like to say that this blog really convinced me to do it! Thanks, very good post. building paramount at miami world center

    ReplyDelete
  13. This information is so useful and informative which you have shared here. It is beneficial for beginners to develop their knowledge. It is very gainful information. Thanks for share it CMA Dubai

    ReplyDelete

Python - Web crawling exercises

Hello Python developer! How are you? Hope you've been good and had wonderful time with Python. There are 10 Python requests module exerc...