#59 How to build a Simple Calculator in Python | if-else loop | basic calculator#python#calculator

preview_player
Показать описание

Full graphical (turtle programs) playlist link:-

Here on this channel you get different types of Python programs.So if you like the content hit the like button👍 and subscribe the channel @Anukrat Mishra  .

THANK YOU!!!

how to build a simple calculator in python,calculator program in python,learn python,calculator,python,example program,python tutorials,python programming,programming,python video tutorials,python tutorial for beginners,python video tutorials for beginners
Рекомендации по теме
Комментарии
Автор

Python my favorite language❤ it's so easy.... 🤗

ToBeMotivate
Автор

print("select two numbers")
n1=float(input("enter first number="))
n2=float(input("enter second number="))
print("calculator menu")
print("1.add(+)")
print("2.subtract(-)")
print("3.multiply(*)")
print("4.divide(*)")
print("5.exit")
op=input("enter operation=")
if option=="1":
print(n1+n2)
elif option=="2":
print(n1-n2)
elif option=="3":
print(n1*n2)
elif option=="4":
print(n1/n2)
elif option=="5":
print(exit)
else:
print("invalid option")



Is this code correct for this??

ArjunDas-vqrk
Автор

x='Yes'
while x =='Yes' or x=='yes':
a=float(input('Enter first no.:'))
b=float(input('Enter second no.:'))
y = input('Enter a sign b/w +, -, *, /, **, //:')
if y=='+':
c=a+b
print('Sum is', c)
elif y=='-':
c=a-b
print('Subtraction is', c)
elif y=='*':
c=a*b
print('Multiplication is', c)
elif y=='/':
c=a/b
print('Float division is', c)
elif y=='**':
c=a**b
print('a to the power b is', c)
elif y=='//':
c=a//b
print('Integer division is', c)
else:
print('Give a valid input')
x=input('Enter Yes to run code or NO to stop code:')

silentgamerfreefire
Автор

There is an error in the code that it will not return to have the new values.

sairoshikkandula
Автор

U should have to use float in place of integer.

Ayush_pandey
Автор

THIS ONE IS RIGHT CODE TRY THIS
>
>
>
>
>
>
>


print("select two numbers")
n1=float(input("enter first number="))
n2=float(input("enter second number="))
print("calculator menu")
print("1.add(+)")
print("2.subtract(-)")
print("3.multiply(*)")
print("4.divide(*)")
print("5.exit")
op=input("enter operation=")

if op=="1":
print(n1+n2)

elif op=="2":
print(n1-n2)

elif op=="3":
print(n1*n2)

elif op=="4":
print(n1/n2)

elif op=="5":
print(exit)

else:
print("invalid option")

HARSH-qwoz
visit shbcf.ru