Python Program to Make a Simple Calculator using functions

preview_player
Показать описание
Simple python program to make a calculator with the help of functions :)

Download link of file
Рекомендации по теме
Комментарии
Автор

Without using a single word you made me understandable the program.
Thank you

syedadeel
Автор

Thank you so much, this is very useful! ❤️

aengraciaaguilar
Автор

Thank you so much
Please make more video related to python programs for class 12.

harshitgiri
Автор

Make another, please. Same music is fine. So long as there is music and it has this vibe.

Bruhne
Автор

hi bro, do you know how to re-enter a code after exiting in option 6?

njvckex
Автор

def add(n1, n2):
return n1+n2
def subtract(n1, n2):
return n1- n2
def multiply(n1, n2):
return n1*n2
def divide(n1, n2):
return n1//n2

operations = {

"+" : add,
"-" : subtract,
"*" : multiply,
"/" : divide
}
def calculator():
print(logo)
parsed = False
while not parsed:
try :
num1 = float(input("What is the first number : "))
parsed = True
except ValueError:
print('type a valid number')
for symbol in operations:
print(symbol)
kino = False
while not kino :
operation_symbols = input("Pick an operation : ")
num2 = float(input("What is the next number : "))
calculation_function = operations[operation_symbols]
answer = calculation_function(num1, num2)
print(f"{num1} {operation_symbols} {num2} = {answer}")

if input(f"type 'y' to continue calculating with {answer}, or type 'n' to start a new calculation. : ") == "y":
num1 = answer
else :
kino = True
calculator()
calculator()

natasdabsi
Автор

You donut i barely passed the python test with ur code

semumula