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)
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
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))
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.
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
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. 🥴
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("
")
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)
excellent! im taking a programming class soon. this truly was helpful!
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
pleasure
keep learning :)
it was great!
also you can .capitalize the input to simplify I think
It was very useful!
Glad you liked it!
this was really cool to do , thank you . very easy to follow and not timeconsuming
Glad it was helpful!
Thank you, great job keep them coming.
Pleasure
This video is excellent. Definitely wins a follow
thank you :)
Thank you from pakistan
Thanx bro....
Welcome
cool video)
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))
You taught it very well, BTW are u from India?
thank you
yes i'm from India :)
i didn't understand what is the * represent in import ??
i know that you want to import the functions files
* indicates everything.
import everything from functions file
Bro please make calculate with only if function and print function and choice too. Plz
Thnks 👍
welcome :)
how to run this programm as i have written it in sublime text
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.
can u pls tell me what you had to change?
Can you teach, how we can make add this code to a App like UI.
What's the name of this application?
If u are asking about the editor then it's vs code
Bro i did everything right but when i pick the first and second number it says Invalid choice why is that
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 :)
when i apply the while loop it doest work
what error / issue you are getting?
its okay take your time
It is showing error after i do the work
Like addition is not defined😢
What error you are getting?
Where are you writing this program
visual studio code
Can i use it to write any type of program
There is no real explanation of the use of format starting at 10:06 in the video.
use f-string instead .format is an old fashion
for example
print(f" {number1} + {number2} = {number3}")
How to add trigonometry function
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
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. 🥴
Huuuu