How to Create a Simple Calculator Program using Python ? Video Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 พ.ย. 2024

ความคิดเห็น • 50

  • @pricillaabuele9502
    @pricillaabuele9502 3 ปีที่แล้ว +9

    while True:
    print("What do you want to do")
    print("1 Addition")
    print("2 Subtraction")
    print("3 Multiplication")
    print("4 Division")
    choice = input("Enter your choice :")
    if choice == "q" or choice == "Q":
    break
    num1 = float(input("Enter Number 1 : "))
    num2 = float(input("Enter Number 2 : "))
    if choice == "1":
    print("Result :" + str(num1 + num2))
    elif choice == "2":
    print("Result :" + str(num1 - num2))
    elif choice == "3":
    print("Result :" + str(num1 * num2))
    elif choice == "4":
    if num2 == 0:
    print("Cannot divide by 0")
    else:
    print("Result :" + str(num1 / num2))
    else:
    print("Invalid Choice")
    print("
    ")

  • @terribryan5457
    @terribryan5457 ปีที่แล้ว +4

    from function import
    while True:
    print("what do you want to do")
    print("1 Addition")
    print("2 Subtraction")
    print("3 Multiply")
    print("4 Divide")
    print("press Q key to Exit")
    choice = input("Enter your choice:")
    if choice =='q' or choice == 'Q':
    break
    num1 = float(input("Enter the Number 1 :"))
    num1 = float(input("Enter the Number 2 :"))
    if choice == '1':
    add(num1,num2)
    elif choice == '2':
    subtract(num1,num2)
    elif choice == '3':
    Multiply(num1,num2)
    elif choice == '4':
    Divide(num1,num2)

  • @LinuxBased_Eskimo
    @LinuxBased_Eskimo 5 หลายเดือนก่อน +1

    excellent! im taking a programming class soon. this truly was helpful!

  • @vishnuteja6079
    @vishnuteja6079 5 ปีที่แล้ว +13

    Hopefully I am the first person to comment here
    I truly appreciate the work that u have done bro ...thanks for these programs ..very neat and clean programs
    Please do make more such kind of interesting stuffs with PYTHON .... looking forward to learn those in python
    Thank you

  • @cruzrosasluisuriel4113
    @cruzrosasluisuriel4113 7 หลายเดือนก่อน +1

    it was great!
    also you can .capitalize the input to simplify I think
    It was very useful!

    • @ExampleProgram
      @ExampleProgram  7 หลายเดือนก่อน +1

      Glad you liked it!

  • @adamartinmusic
    @adamartinmusic 8 หลายเดือนก่อน +1

    this was really cool to do , thank you . very easy to follow and not timeconsuming

    • @ExampleProgram
      @ExampleProgram  7 หลายเดือนก่อน

      Glad it was helpful!

  • @madhuhadas15370
    @madhuhadas15370 2 ปีที่แล้ว +3

    Thank you, great job keep them coming.

  • @ErickAlex1
    @ErickAlex1 2 ปีที่แล้ว +1

    This video is excellent. Definitely wins a follow

  • @AbdulWaheed-kg8jq
    @AbdulWaheed-kg8jq ปีที่แล้ว

    Thank you from pakistan

  • @NiroshaHerath-m2u
    @NiroshaHerath-m2u ปีที่แล้ว +2

    Thanx bro....

  • @ElardUzun
    @ElardUzun 8 หลายเดือนก่อน

    cool video)

  • @muhammadahsanali-pq1er
    @muhammadahsanali-pq1er 4 หลายเดือนก่อน

    this is a shorter version of the program and is a proper working 2 digit calculator :
    #this is the simplest calculator you can make in python
    n1 = float(input("enter the first number: "))
    op = input("Enter the operator")
    n2 = float(input("enter the second number: "))
    if op == "+":
    total = n1+n2


    elif op == "/"
    total = n1/n2


    elif op == "-":
    total = n1-n2


    else:
    total = n1*n2
    print("The answer is: ", str(total))

  • @stimmyKnuckle
    @stimmyKnuckle 3 ปีที่แล้ว +2

    You taught it very well, BTW are u from India?

    • @ExampleProgram
      @ExampleProgram  3 ปีที่แล้ว +1

      thank you
      yes i'm from India :)

  • @omaribrahim8702
    @omaribrahim8702 4 ปีที่แล้ว +5

    i didn't understand what is the * represent in import ??
    i know that you want to import the functions files

    • @ExampleProgram
      @ExampleProgram  4 ปีที่แล้ว +4

      * indicates everything.
      import everything from functions file

  • @indragupta7402
    @indragupta7402 3 ปีที่แล้ว +2

    Bro please make calculate with only if function and print function and choice too. Plz

  • @evilmonk4339
    @evilmonk4339 ปีที่แล้ว +1

    Thnks 👍

  • @Super.blazer
    @Super.blazer 3 ปีที่แล้ว +1

    how to run this programm as i have written it in sublime text

  • @alwaysflat7996
    @alwaysflat7996 4 ปีที่แล้ว +3

    This version did not work on sublime text, I had to modify it to get to work, very weird.
    I wrote my own version it works fine on sublime, and it didn't work on VS code either until I modified it.

    • @ExampleProgram
      @ExampleProgram  4 ปีที่แล้ว +1

      can u pls tell me what you had to change?

  • @ameenomar5592
    @ameenomar5592 5 ปีที่แล้ว

    Can you teach, how we can make add this code to a App like UI.

  • @adityarakshit5669
    @adityarakshit5669 4 ปีที่แล้ว +3

    What's the name of this application?

    • @ExampleProgram
      @ExampleProgram  4 ปีที่แล้ว +4

      If u are asking about the editor then it's vs code

  • @mahdi3521
    @mahdi3521 4 ปีที่แล้ว +1

    Bro i did everything right but when i pick the first and second number it says Invalid choice why is that

    • @ExampleProgram
      @ExampleProgram  4 ปีที่แล้ว +1

      you might have done some mistake
      source code of this tutorial is available in my website.
      if u want then you can check it out :)

  • @deekshaparmar1345
    @deekshaparmar1345 4 ปีที่แล้ว +2

    when i apply the while loop it doest work

    • @ExampleProgram
      @ExampleProgram  4 ปีที่แล้ว +1

      what error / issue you are getting?

    • @escape8011
      @escape8011 5 หลายเดือนก่อน

      its okay take your time

  • @SreejaPS-q2z
    @SreejaPS-q2z 6 หลายเดือนก่อน +1

    It is showing error after i do the work
    Like addition is not defined😢

    • @ExampleProgram
      @ExampleProgram  6 หลายเดือนก่อน

      What error you are getting?

  • @deepakpaira0123
    @deepakpaira0123 4 ปีที่แล้ว +1

    Where are you writing this program

  • @we-are-electric1445
    @we-are-electric1445 ปีที่แล้ว

    There is no real explanation of the use of format starting at 10:06 in the video.

    • @soulsenjoyer0
      @soulsenjoyer0 ปีที่แล้ว +1

      use f-string instead .format is an old fashion
      for example
      print(f" {number1} + {number2} = {number3}")

  • @priyankasingh2787
    @priyankasingh2787 4 ปีที่แล้ว

    How to add trigonometry function

    • @zinlinhtun1510
      @zinlinhtun1510 4 ปีที่แล้ว +2

      Hello, if you want to include that, import math then math.sin or math.cos, etc. You can also try for square root and powers like math.sqrt and math.pow(x,y) they are all under math module

  • @S1Iiz
    @S1Iiz 2 ปีที่แล้ว

    Another of the same tutorial videos on another TH-cam channel... Really? Did you steal this idea from someone else and post it on your channel? Because the year that has been posted from another channel is a bit earlier than yours. 🥴

  • @squadsync3
    @squadsync3 6 หลายเดือนก่อน

    Huuuu