Python calculator program 🧮

  Рет қаралды 197,258

Bro Code

Bro Code

Күн бұрын

#python #tutorial #code
operator = input("Enter an operator (+ - * /): ")
num1 = float(input("Enter the 1st number: "))
num2 = float(input("Enter the 2nd number: "))
if operator == "+":
result = num1 + num2
print(round(result, 3))
elif operator == "-":
result = num1 - num2
print(round(result, 3))
elif operator == "*":
result = num1 * num2
print(round(result, 3))
elif operator == "/":
result = num1 / num2
print(round(result, 3))
else:
print(f"{operator} is not a valid operator")

Пікірлер: 147
@BroCodez
@BroCodez 2 жыл бұрын
operator = input("Enter an operator (+ - * /): ") num1 = float(input("Enter the 1st number: ")) num2 = float(input("Enter the 2nd number: ")) if operator == "+": result = num1 + num2 print(round(result, 3)) elif operator == "-": result = num1 - num2 print(round(result, 3)) elif operator == "*": result = num1 * num2 print(round(result, 3)) elif operator == "/": result = num1 / num2 print(round(result, 3)) else: print(f"{operator} is not a valid operator")
@jocepsi674
@jocepsi674 2 жыл бұрын
I just wanted to tell you that please continue uploading courses/ classes ... maybe it won't be too much for you, but because of you and your videos I finally decide to start learning to code. Thank you
@seif44
@seif44 2 жыл бұрын
How do it in console like 5+4 give me 9 without make it like this 5 Enter + Enter 4 And allow the user to quit or perform another operation
@Crhistianoronaldo-n6d
@Crhistianoronaldo-n6d Жыл бұрын
bro has a great .pharaoh's first concubine?.
@lizk9963
@lizk9963 Жыл бұрын
operator = input("Enter an operator (+ - * /): ") if operator == "+" or operator == "-" or operator == "*" or operator == "/" : num1 = float(input("Enter the 1st number: ")) num2 = float(input("Enter the 2nd number: ")) if operator == "+": result = num1 + num2 elif operator == "-": result = num1 - num2 elif operator == "*": result = num1 * num2 elif operator == "/": result = num1 / num2 print(round(result, 3)) else: print(f"{operator} is not a valid operator")
@Mine_animator-d2l
@Mine_animator-d2l 8 ай бұрын
tnx so much man
@luvsk-rg2xq
@luvsk-rg2xq Жыл бұрын
"I'm not comfortable accepting donations for my work. Rather, I would like to encourage you to donate to a struggling family or a charity of your choosing." He really said that. Truly a bro we all need.
@charakamal2000
@charakamal2000 Жыл бұрын
I never thought of being a coder until I saw your videos, thank you so muck
@charakamal2000
@charakamal2000 Жыл бұрын
*much*😅
@mohammadiaa
@mohammadiaa 7 ай бұрын
@@charakamal2000 there's an edit comment fetus btw
@mohammadiaa
@mohammadiaa 7 ай бұрын
feature*
@IIT-DHOLAKPUR.
@IIT-DHOLAKPUR. 5 ай бұрын
​@@mohammadiaaLol you spilled it wrong too
@IIT-DHOLAKPUR.
@IIT-DHOLAKPUR. 5 ай бұрын
Spelled*
@Theebestest
@Theebestest Жыл бұрын
i’d personally prefer it goes like this the 1st number, then the operation and then the second number. it seems more user friendly, but thank you for the tutorial !
@Afran146
@Afran146 Жыл бұрын
This course has been incredible! Thank you!!
@zahranurrohma9220
@zahranurrohma9220 Жыл бұрын
Thank you for the lesson, this is what I made today :D operator = input("Enter an operator (+ - * /): ") valid_operator = list ["+","-","*","/"] if operator not in valid_operator: print(f"{operator} is not a valid operator") exit() num1 = float(input("Enter the 1st number: ")) num2 = float(input("Enter the 2nd number: ")) if operator == "+": result = num1 + num2 print(round(result, 3)) elif operator == "-": result = num1 - num2 print(round(result, 3)) elif operator == "*": result = num1 * num2 print(round(result, 3)) elif operator == "/": result = num1 / num2 print(round(result, 3)) else: print("")
@lm2thed142
@lm2thed142 11 ай бұрын
nice use of lists . i wanted to do something like that but was unsure of oding so
@anifowosedaniel7515
@anifowosedaniel7515 5 ай бұрын
This won't give the result. It will say, it's not a valid operator even after listing the operators when code's been run
@twigginbarrys
@twigginbarrys 9 ай бұрын
I just started watching your videos yesterday and I wish I had started a long time ago I am having too much fun. operator = input("pick and operation (+, -, *, /) ") if operator == "+": num1 = float(input("what is the first number you would like to add to? ")) num2 = float(input("what is the second number you would like to add? ")) result = num1 + num2 print(f"{num1} plus {num2} equals {(round(result, 3))}") elif operator == "-": num1 = float(input("what is the first number you would like to subtract from? ")) num2 = float(input("what is the second number you would like to subtract by? ")) result = num1 - num2 print(f"{num1} minus {num2} equals {(round(result, 3))}") elif operator == "*": num1 = float(input("what is the first number you would like to multiply? ")) num2 = float(input("what is the second number you would like to multiply by? ")) result = num1 * num2 print(f"{num1} multiplied by {num2} equals {(round(result, 3))}") elif operator == "/": num1 = float(input("what is the first number you would like to divide? ")) num2 = float(input("what is the second number you would like to divide by? ")) result = num1 / num2 print(f"{num1} divided by {num2} equals {(round(result, 3))}") else: print("INVALID SELECTION! Please try again")
@yeahiamdhabibullah7572
@yeahiamdhabibullah7572 4 ай бұрын
You are the best code tutor.
@gaddafisuleiman8882
@gaddafisuleiman8882 2 жыл бұрын
So happy 😁 you uploaded a video. 😅 I've been waiting....
@segujatwaib7033
@segujatwaib7033 2 жыл бұрын
it is simple and easy to understand
@lookatrobot
@lookatrobot Жыл бұрын
Thank U brother for this Course, I have no words to explain it, btw Your voice is so Cool! 💗
@Alajmi346
@Alajmi346 Жыл бұрын
a=input("enter your first numper ") a1=input("enter your second numper ") s1=int(a)+int(a1) s2=int(a)/int(a1) s3=int(a)*int(a1) s4=int(a)-int(a) calcul=input("calcule +,/,*,-") if (calcul)=="+": print(s1) if (calcul)=="/": print(s2) if (calcul)=="*": print(s3) if (calcul)=="-": print(s4)
@Gergo_kecske
@Gergo_kecske 4 ай бұрын
thank you soo much bro you are the best coding youtuber
@Tom-ks9xl
@Tom-ks9xl Жыл бұрын
This is fantastic
@wmstram1
@wmstram1 Жыл бұрын
Watched it. Liked it.
@julkarnayenshish1712
@julkarnayenshish1712 2 жыл бұрын
I predict,this channel will become more popular than cs50 or freecodecamp or any other coding channels in youtube if this kind of content continues to be uploaded.
@Reymax164
@Reymax164 6 ай бұрын
He's already more popular than cs50… But codecamp is a whole ahh organization, a single person can't beat a whole org's quantity of courses.
@WINDOWSUSER-q4s
@WINDOWSUSER-q4s Жыл бұрын
NICELY DONE...❤
@Priceygames
@Priceygames Жыл бұрын
Ive learned C++ from your videos, Python is just so easy
@currytut455
@currytut455 7 ай бұрын
what happens when you divide 1/0 or some x/0 because i have a major problem in doing the operations when its some number over zero (x/0), can you help me please or maybe someone else in the comment sections who maybe come across such a problem and was able to debug or solve the problem it would be very helpful to me.
@Cat-memes_official625
@Cat-memes_official625 7 ай бұрын
Explain your issue again pls
@currytut455
@currytut455 6 ай бұрын
​@@Cat-memes_official625When I attempt the operation 1/0 using the Python calculator code, it returns an error message. I struggled to debug this message and wanted the code to print "Undefined" for x/0 division operations rather than an error message. That's all I wanted.
@Dinamight77
@Dinamight77 6 ай бұрын
@@currytut455 Think about what you've learned about if statements. If num2 is equal to 0, then...
@currytut455
@currytut455 6 ай бұрын
@@Dinamight77 thanks i used some if statements and it worked, and i learnt a new trick of using try statements also.😁
@SubmitterNineteen-zi5nx
@SubmitterNineteen-zi5nx Жыл бұрын
great job. straight to the point
@RidA.G
@RidA.G 3 ай бұрын
I have done this code before I seen this video whaaaaaattt🎉
@perfectionist2994
@perfectionist2994 Жыл бұрын
Thank you for your video)
@Curious_Clover
@Curious_Clover 10 ай бұрын
I feel like there's a shorter code for this. But this is perfect for my simple and straightforward approach for things.
@thosan3090
@thosan3090 2 жыл бұрын
Can you teach us how to code a calculator program that can calculate the math expression from an input string like 2 * (9 - 16/4), I will very appreciate it sir.
@miquelr2353
@miquelr2353 Жыл бұрын
Chatgpt will write entire code for you
@batrix6242
@batrix6242 Жыл бұрын
eval()
@Zephyr__Edits
@Zephyr__Edits Жыл бұрын
Bro......... perfect👌
@Kar0lina-d5u
@Kar0lina-d5u Жыл бұрын
Thanks for your video. :D
@UkrainianSolarYT
@UkrainianSolarYT 2 ай бұрын
Thanks for this, this was one of my first programs
@Friday_42
@Friday_42 7 ай бұрын
That was fun! I was trying to get a statement to print, where if the user input an invalid operator it would print it before asking for num1 & num2. Got to find out what command that is though.
@sahil8492-b5r
@sahil8492-b5r Жыл бұрын
I have been interested in coding more after I did this code!
@dianajumanazarova-i5w
@dianajumanazarova-i5w Жыл бұрын
a=int(input()) if a%4==0: print("kabisa") else: print("kabisa emas")
@ihatenamez
@ihatenamez 2 жыл бұрын
thank you ur tutorials help me a lot
@Flame_PvP
@Flame_PvP Жыл бұрын
Thanks cool vid helped me out alot 😃
@runaan7382
@runaan7382 11 ай бұрын
what are f strings used for? i see them all the time but i dont understand what makes them different from a normal print
@demon3769
@demon3769 8 ай бұрын
in f strings we can insert any variable that we have created without any errors and can perform manipulations easily like age=12 if we use print function like print(f"the stan is {age} years old) in this above line at that age placed in curly bracket will show number 12 if print function is executed
@Nit5ua
@Nit5ua 5 ай бұрын
thanks for this I tasked my son with making a calculator this should help him.
@dennisowusu2570
@dennisowusu2570 Жыл бұрын
How do you perform the next operation on the next previous calculated answer
@edanonera
@edanonera 5 ай бұрын
The tutorial is good, but you also can do: print(eval(input("enter ")))
@nanzingnanmwa445
@nanzingnanmwa445 10 ай бұрын
You're a life saver ❤️
@gamingminecraft-e5c
@gamingminecraft-e5c 8 ай бұрын
I coded my self and now i know that there is an elseif command 😊
@AyaanRocks-m8d
@AyaanRocks-m8d Жыл бұрын
You made it a bit simple, maybe next video try to make it with functions, that would be a good video.
@DATGUY87
@DATGUY87 10 ай бұрын
Hello BroCode, I need a bit of help. When I type in the division symbol, nothing comes up but the other operators are fine. I double checked but (/ )was still not working
@kasperlindh9245
@kasperlindh9245 Ай бұрын
I cant find a way to get it to display the answer, and thats with an exact coppy of your code? Im just hella confused. pls help
@AestheticBlue13
@AestheticBlue13 7 ай бұрын
# CALCULATOR PROGRAM operator = input("Enter an operator (+ - * /): ") num1 = float(input("Enter the 1st number: ")) num2 = float(input("Enter the 2nd number: ")) if operator == "+": result = num1 + num2 print(round(result, 3)) elif operator == "-": result = num1 - num2 print(round(result, 3)) elif operator == "*": result = num1 * num2 print(round(result, 3)) elif operator == "/": result = num1 / num2 print(round(result, 3)) else: print(f"{operator} is not a valid operator :(") INPUT Enter an operator (+ - * /): + Enter the 1st number: 1 Enter the 2nd number: 1 OUTPUT 2.0
@mdarafat..
@mdarafat.. 6 ай бұрын
nice
@andreip8351
@andreip8351 11 ай бұрын
Calculator ------------------------ number1 = float(input("> 1st number: ")) number2 = float(input("> 2nd number: ")) accepted_operators = ["+", "-", "*", "/"] operator = input("> operators (+ - * /): ") while not operator in accepted_operators: print("Incorrect operator!") operator = input("> operators (+ - * /): ") if operator in accepted_operators: break if operator == "+": print("Result:", number1+number2) elif operator == "-": print("Result:", number1-number2) elif operator == "*": print("Result:", number1*number2) else: print("Result:", number1/number2) ------------------------
@daydarasensei12
@daydarasensei12 2 жыл бұрын
Hey Bro, LOVE YOUR VIDS!! can you tell me which one gives more value? the 12 hours vid or the python for beginners playlist!! PLEASE HELP
@Borgcide
@Borgcide Жыл бұрын
I watched all your earlier lessons, And i stopped the video and made a calculator by myself, I used ×,÷ instead of * and / and your code is also different than me
@felaps
@felaps Жыл бұрын
what can i do if i want once the operation is made to ask again for the operation?
@vaggelisgeorgiou2491
@vaggelisgeorgiou2491 7 ай бұрын
I just picked up coding and I absolutely love your tutorials, thank you Bro for all the effort you put in!! I have a question. Couldn't we have made only one print( ) in the end of all the if elif else? Something like print(f" {num1} {operator} {num2} = {result} ") Wouldn't that work instead of having many print( ) statements for all the steps?
@DarkTemplarKain
@DarkTemplarKain Жыл бұрын
by any chance could you tell me how to find this version of python? having a hard time finding it for whatever reason.
@Jo-March-Wandering-By
@Jo-March-Wandering-By 11 ай бұрын
It's Pycharm. Don't know the version of Pycharm he uses.
@DarkTemplarKain
@DarkTemplarKain 11 ай бұрын
@@Jo-March-Wandering-By thank you, i appreciate it.
@raiyanjutt4789
@raiyanjutt4789 Ай бұрын
operator=input("enter an operator(+-*/)") num1=float(input("enter the first number")) num2=float(input("enter the second number")) if operator=="+": print(num1+num2) elif operator=="-": print(num1-num2) elif operator=="*": print(num1*num2) elif operator=="/": print(num1/num2) else: print(f" {operator} is not valid plz try using+-/*") i made it pretty simple not rounded the values because made it in a rush
@gamingit1
@gamingit1 Жыл бұрын
Thanks! You helped me finish my calculator! I used part where you can choose operation and everthing else came out of my brain. Thanks for helping me!
@Jo-March-Wandering-By
@Jo-March-Wandering-By 11 ай бұрын
Huge disadvantage here... what if you want to subtract num2 by num1 instead of num1?
@That-one-guy307
@That-one-guy307 8 ай бұрын
Hey what prgrame software is he using
@hunin27
@hunin27 Жыл бұрын
At the end you said that unfortunately we still have to type in the numbers, but can't we put the else statement as an if statement and then put an else statement that does nothing?
@hunin27
@hunin27 Жыл бұрын
i wrote this code: operator = input("Enter an operator (+ - * /): ") num1 = float(input("Enter the 1st number: ")) num2 = float(input("Enter the 2nd number: ")) valid_operators = ["+", "-", "*", "/"] if operator not in valid_operators: print(f"{operator} is not a valid operator") elif operator == "+": result = num1 + num2 print(round(result, 3)) elif operator == "-": result = num1 - num2 print(round(result, 3)) elif operator == "*": result = num1 * num2 print(round(result, 3)) elif operator == "/": result = num1 / num2 print(round(result, 3)) else: print("") i don't get why you still have to write the numbers before printing the "operator is not a valid operator"
@sahtarwars8386
@sahtarwars8386 Жыл бұрын
@@hunin27 Not working , shows invalid , why did you use it as a list ? I removed the list and then it worked.
@hunin27
@hunin27 Жыл бұрын
no way. bro this comment was 7 months ago. i am a front end dev now. :)@@sahtarwars8386
@dents1332
@dents1332 7 ай бұрын
why we cant just: else: print(operator + " is not a valid operator")
@micotraspe1435
@micotraspe1435 9 ай бұрын
How if its like choose a number and the number 1 is Addition 2 is subtraction and 3 is multiplication and 4 is division?
@zahraalemi1872
@zahraalemi1872 Жыл бұрын
🤩🤩🤩
@codeowlhnko
@codeowlhnko Жыл бұрын
Please what app are you using?
@AnxiousFrenchFries
@AnxiousFrenchFries Жыл бұрын
PyCharm
@stormgx759
@stormgx759 Жыл бұрын
nice name@@AnxiousFrenchFries
@kellykou5357
@kellykou5357 Жыл бұрын
What if the user input a string in temp? What can we add in the if statement?
@97_L1vyyy
@97_L1vyyy 11 ай бұрын
when i run it and i enter enverything and press enter it closes help
@joncaldwell4753
@joncaldwell4753 8 ай бұрын
Thank you Bro
@zahraalemi1872
@zahraalemi1872 Жыл бұрын
😍😍😍
@MandelbrotWorm
@MandelbrotWorm Жыл бұрын
This is my calculator: print("""+ is addition - is subtraction * is multiplication / is division ** is power // is full division % is the division's remainder """) which1 = input("Choose either +, *, /, -, %, // or ** to do your calculation") number1 = float(input("First Number: ")) number2 = float(input("Second Number: ")) if which1 == '+': print(number1 + number2) elif which1 == '*': print(number1 * number2) elif which1 == '/': print(number1 / number2) elif which1 == '-': print(number1 - number2) elif which1 == '//': print(number1 // number2) elif which1 == '%': print(number1 % number2) elif which1 == '**': print(number1 ** number2) else: print("Invalid Operator")
@_KDP
@_KDP Жыл бұрын
i dont think that would work last time i checked you couldnt do print"hello boi") just saying :D
@Abzarad
@Abzarad 9 ай бұрын
thanks Bro
@Theuser-z5w
@Theuser-z5w 11 күн бұрын
what ide is used ?
@steev708
@steev708 Жыл бұрын
Hey, I have a doubt? Why can't we "return" the result, instead of print?
@RukhshandaShamim
@RukhshandaShamim Ай бұрын
Because 'return' stores the output but does not display on output screen Only 'print' displays the value on output screen Return is useful when we only want to store value and not display it I hope u understood... 😊
@pajokamikaze
@pajokamikaze 6 ай бұрын
I think that pizza would be a great operator :c
@yashmitnigam8184
@yashmitnigam8184 4 ай бұрын
yes
@Peyman13822
@Peyman13822 Жыл бұрын
thanks
@bekturasanbekov1979
@bekturasanbekov1979 Жыл бұрын
thx 4 vid bro !
@TypicalVole2437
@TypicalVole2437 2 жыл бұрын
thank you
@bro_NoReason
@bro_NoReason 17 күн бұрын
What if they enter "pizza" as a number?
@rdkrdk1094
@rdkrdk1094 10 ай бұрын
done
@vovanosa2827
@vovanosa2827 2 жыл бұрын
bruh the python console💀💀
@zbigniewsmyk
@zbigniewsmyk 2 жыл бұрын
whats wrong with it?
@saadalirizvi5161
@saadalirizvi5161 4 ай бұрын
Better than C++ 💀
@tonylovesmusic
@tonylovesmusic 3 ай бұрын
bruh it's pycharm get use to it you'll see it a lot!!
@RidA.G
@RidA.G 3 ай бұрын
It's so easy bro python
@DrAmosMungai
@DrAmosMungai 20 күн бұрын
Yoohhhhhhh seeing this in 2025 is exasperating 🎉🎉
@SouLDYNAMOX9
@SouLDYNAMOX9 11 ай бұрын
I made this same program but with area,volume perimeter and arthmetic operation (+ - * / )
@DerSpechtGD
@DerSpechtGD 6 ай бұрын
I made this already :^) import math print("1 = +") print("2 = -") print("3 = *") print("4 = /") print("5 = Squareroot") print("6 = Power") print("7 = Circumference") print("8 = Area circle") print("9 = Hypotenuse") operation = str(input("Choose your operation: ")) if operation == str(1): number1 = float(input("Number 1: ")) number2 = float(input("Number 2: ")) result = number1 + number2 print(f"{number1} + {number2} = {result}") elif operation == str(2): number1 = float(input("Number 1: ")) number2 = float(input("Number 2: ")) result = number1 - number2 print(f"{number1} - {number2} = {result}") elif operation == str(3): number1 = float(input("Number 1: ")) number2 = float(input("Number 2: ")) result = number1 * number2 print(f"{number1} * {number2} = {result}") elif operation == str(4): number1 = float(input("Number 1: ")) number2 = float(input("Number 2: ")) result = number1 / number2 print(f"{number1} / {number2} = {result}") elif operation == str(5): sqrt = float(input("Enter the number for your squareroot: ")) result = round(math.sqrt(sqrt), 4) print(f"The squareroot of {sqrt} is {round(result, 2)}") elif operation == str(6): base = float(input("Enter the base: ")) exp = float(input("Enter the exponent: ")) result = math.pow(base, exp) print(f"{base}^{exp} = {round(result, 2)}") elif operation == str(7): radius = float(input("Enter the radius: ")) result = 2 * math.pi * radius print(f"The circumference of the circle is: {round(result, 2)}") elif operation == str(8): radius = float(input("Enter the radius: ")) result = math.pi * math.pow(radius, 2) print(f"The area of the circle is: {round(result, 2)}") elif operation == str(9): a = float(input("Enter the lenght of side A: ")) b = float(input("Enter the lenght of side B: ")) result = math.sqrt(math.pow(a, 2) + math.pow(b, 2)) print(f"The lenght of the Hypotenuse is: {round(result, 2)}") else: print("This option is not available!")
@hunin27
@hunin27 Жыл бұрын
in this updated code it says: The result is : result instead of just giving the result operator = input("Enter an operator (+ - * /): ") num1 = float(input("Enter the 1st number: ")) num2 = float(input("Enter the 2nd number: ")) if operator == "+": result = num1 + num2 print("The result is: " + (str(round(result, 3)))) elif operator == "-": result = num1 - num2 print("The result is: " + (str(round(result, 3)))) elif operator == "*": result = num1 * num2 print("The result is: " + (str(round(result, 3)))) elif operator == "/": result = num1 / num2 print("The result is: " + (str(round(result, 3)))) else: print(f"{operator} is not a valid operator")
@Yumiesthetic
@Yumiesthetic Жыл бұрын
remove the str function lol
@wilfredomina2301
@wilfredomina2301 Жыл бұрын
it says Syntax error at line 2 of your code: invalid syntax
@The-MaliX
@The-MaliX 14 күн бұрын
or you can just do print(eval(input()))
@quitefern
@quitefern Жыл бұрын
operator = input("Enter an operator (+ - * /): ") if operator != "+" and operator != "-" and operator != "*" and operator != "/": print(operator + " is not a valid operator") else: num1 = float(input("Enter the 1st number: ")) num2 = float(input("Enter the 2nd number: ")) if operator == "+": result = num1 + num2 print(round(result, 3)) elif operator == "-": result = num1 - num2 print(round(result, 3)) elif operator == "*": result = num1 * num2 print(round(result, 3)) elif operator == "/": result = num1 / num2 print(round(result, 3)) Here is my code where I got rid of the problem of having to enter numbers after not entering a correct operator. I was a little confused because I put or instead of and so I had to put it into ChatGPT to understand what I did wrong but it felt good to come up with this solution.
@markusscvilikovskis9051
@markusscvilikovskis9051 2 жыл бұрын
Why are you reuploading?
@vipergenix8839
@vipergenix8839 Жыл бұрын
But how do I loop it😢
@noliyeb
@noliyeb Жыл бұрын
vize_notu = int(input("Vize notunuzu giriniz: ")) final_notu = int(input("Final notunuzu giriniz: ")) if 101 > vize_notu > -1: num1 = vize_notu else: print("Geçerli bir vize notu giriniz.") if 101 > final_notu > -1: num2 = final_notu else: print("Geçerli bir final notu giriniz.") toplam_not = (num1 * 40 / 100) + (num2 * 60 / 100) if toplam_not >= 50: print(f"Tebrikler! Sınıfı geçtiniz. Notunuz: {toplam_not} ") elif toplam_not < 50: print(f"Maalesef dersi geçemediniz. Notunuz: {toplam_not}")
@avyaangupta7341
@avyaangupta7341 3 ай бұрын
#Basic calculator num1= float(input("enter the number: ")) operator= (input("enter the opperation(+,-,/,*): ")) num2= float(input("enter the number: ")) if operator== "+": print("answer: ", num1 + num2) elif operator== "-": print("answer: ",num1-num2) elif operator=="*": print("answer: ",num1*num2) elif operator=="/": print("answer: ",num1 / num2) else: print(f"{operator} does not exist.") #(this should work well, and in a more natural language format..)
@emmanuelgibson6657
@emmanuelgibson6657 Жыл бұрын
Thank you guys
@JOJO77TRUE
@JOJO77TRUE Жыл бұрын
lindo
@oliispyder
@oliispyder Жыл бұрын
i did this instead num_1 = float(input("Enter Your first number!: ")) num_2 = float(input("Enter Your second number!: ")) operator = input("Enter and Operator from /, +, - and *") if operator == "*": print(f"Your result is: {num_1 * num_2}") elif operator == "+": print(f"Your result is: {num_1 + num_2} ") elif operator == "-": print(f"Your result is: {num_1 - num_2} ") elif operator == "/": print(f"Your result is: {round(num_1 / num_2, 2)} ") else: print(f"{operator} isnt a valid operator!")
@Crhistianoronaldo-n6d
@Crhistianoronaldo-n6d Жыл бұрын
.pharaoh's first concubine?..pharaoh's first concubine?..pharaoh's first concubine?.
@Bry858
@Bry858 7 ай бұрын
OK the program im using is not working but it is not your fault but idk what to do
@leemichaelsantos9171
@leemichaelsantos9171 4 ай бұрын
It didnt work for me
@przemek4574
@przemek4574 Жыл бұрын
Mine calculator is better: print(eval(input("Calculator")))
@drewplays9007
@drewplays9007 2 жыл бұрын
first
Functions in Python are easy 📞
10:38
Bro Code
Рет қаралды 658 М.
Making a Game in Python with No Experience
5:57
Goodgis
Рет қаралды 1,8 МЛН
Мясо вегана? 🧐 @Whatthefshow
01:01
История одного вокалиста
Рет қаралды 7 МЛН
Build this JS calculator in 15 minutes! 🖩
15:20
Bro Code
Рет қаралды 781 М.
25 nooby Python habits you need to ditch
9:12
mCoding
Рет қаралды 1,8 МЛН
Simple Calculator Project In Python (For Beginners)
8:44
Yousef Computer Science
Рет қаралды 1,8 М.
How to Build a Simple Calculator in Python - Step by Step 1
15:37
Kindson The Tech Pro
Рет қаралды 396 М.
Python - полный курс для начинающих. Этот навык изменит твою жизнь.
5:23:33
Let's code a beginner Python BANKING PROGRAM 💰
15:01
Bro Code
Рет қаралды 356 М.
5 Good Python Habits
17:35
Indently
Рет қаралды 718 М.
10 Important Python Concepts In 20 Minutes
18:49
Indently
Рет қаралды 505 М.
How to Code (almost) Any Feature
9:48
DaFluffyPotato
Рет қаралды 718 М.
Мясо вегана? 🧐 @Whatthefshow
01:01
История одного вокалиста
Рет қаралды 7 МЛН