Created
September 14, 2021 13:57
-
-
Save ibelgin/1ee3c354b52020b2e03320a4dc4f8b9e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
print(" \n Please Select the opertaion 1. Add 2. Subract 3. Multiply 4. Divide \n") | |
select = int(input("->")) | |
print(" ") | |
num1 = int(input("Enter the First Number - ")) # 3 | |
num2 = int(input("Enter the Second Number - ")) # 2 | |
def add(num1 , num2): | |
sum = num1 + num2 | |
print("Sum of ",num1 , "and ",num2 ,"is ", sum) | |
def sub(num1 , num2): | |
sub = num1 - num2 | |
print("Sub of ",num1 , "and ",num2 ,"is ", sub) | |
def multiply(num1 , num2): | |
multiply = num1 * num2 | |
print("multiply of ",num1 , "and ",num2 ,"is ", multiply) | |
def divide(num1 , num2): | |
divide = num1 / num2 | |
print("div of ",num1 , "and ",num2 ,"is ", divide) | |
if select == 1: | |
add(num1,num2) | |
elif select == 2: | |
sub(num1,num2) | |
elif select == 3: | |
multiply(num1 , num2) | |
elif select == 4: | |
divide(num1,num2) | |
else: | |
print("Enter a correct choice") | |
This file contains hidden or 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
import random | |
values = [1,2,3,4,5,6] | |
repeat = "yes" | |
print("Enter Yes or y to continue or any other letter to stop the program ") | |
while repeat == "yes" or repeat == "y": | |
result = random.choice(values) | |
print("The Random value is ", result ) | |
repeat = input("Do you want to continue ? - ") | |
This file contains hidden or 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
num1 = int(input("Enter the first number - ")) | |
num2 = int(input("Enter the second number - ")) | |
sum = num1+num2 | |
sub = num1-num2 | |
prod = num1*num2 | |
div = num1/num2 | |
print("Sum of ",num1 , "and ",num2 ,"is ", sum) | |
print("Sub of ",num1 , "and ",num2 ,"is ", sub) | |
print("Prod of ",num1 , "and ",num2 ,"is ", prod) | |
print("Div of ",num1 , "and ",num2 ,"is ", div) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment