Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Python_Telegram_Chat_bot/calcuator.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
27 lines (27 sloc)
738 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function calcuator() | |
print ("chose operation") | |
print ("A. add") | |
print("B. subtract") | |
print("C. multiply") | |
print("D.Divide") | |
choice = input("enter choice (A/B/C/D") | |
X1= int(input("Enter first number: ")) | |
X2= int (input("Enter second number ")) | |
if choice == 'A' | |
print(X1, "+", X2, "=", add(X1, X2)) | |
elif choice =='B' | |
print (X1, "-", X2, "=", subtract (X1, X2)) | |
elif choice == 'C' | |
print(X1, "*", X2, "=", multiply(X1, X2)) | |
elif choice== 'D' | |
print(X1, "/", X2, "=", divide(X1, X2)) | |
else: | |
print(syntax error) | |
def add(x , y) | |
return x + y = ans | |
def subtract(x , y) | |
return x - y = ans | |
def mulitply (x , y) | |
return x * y = ans | |
def divide (x , y) | |
return x / y = ans |