Skip to content

Commit a4242fe

Browse files
committed
exercise
exercise
1 parent 8dc0754 commit a4242fe

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

calculator.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#Returns the sum of num1 and num2
2+
def add(num1, num2): #function signature
3+
return num1 + num2
4+
5+
def main():
6+
operation = input("what do you want to do (+,-,*,/):")
7+
if(operation != '+' and operation != '-' and operation != '*' and operation != '/'):
8+
print("You must enter a valid operation")
9+
else:
10+
var1 = int(input("Enter num1: "))
11+
var2 = int(input("Enter num2: "))
12+
if(operation == '+'):
13+
print(add(var1, var2))
14+
main()

helloworld.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
def hello(myString):
2+
print(myString)
3+
print("hello")
4+
myName = input ("what's your name:")
5+
myVar = input ("Enter your number:")
6+
if(myName == "David" or myVar != 0):
7+
print ("Hello David")
8+
else:
9+
print ("Hello world")
10+
11+
12+
hello("Tits")

0 commit comments

Comments
 (0)