-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsumOfTwoNumbers.py
More file actions
67 lines (52 loc) · 1.32 KB
/
Copy pathsumOfTwoNumbers.py
File metadata and controls
67 lines (52 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
def product(x, y):
x * y;
#Just creating a function.
def printResult():
#tell user "answer is " sum
print ("Yo", name + "!");
print ("The answer is", sum);
print ("This is the product just in case you need it!", product);
if (sum > 100):
print ("Wow this is a large number!")
elif (sum == 33):
print ("That's My age!", sum)
else:
print ("Meh... Number is small...")
#Put your name in this box.
name = input("What is your name? ")
#Ask them to add numbers.
print ("Hi, {}".format(name),"how are you today? Ready to add some numbers right quick?");
#create an integer variable for x
x = 0
#create an integer variable for y
y = 0
#create an interger variable for sum
sum = 0
#ask the user for "X: " and put answer in x
x = input("Fist Number: ")
#ask the user for "Y: " and put answer in y
y = input("Second Number: ")
#convert x to integer:
x = int(x)
#convert y to integer:
y = int(y)
#put x + y in sum
sum = x + y
product = x * y
#tell user "answer is " sum
printResult()
def multiplyNum(x, y):
print (product);
niggas = sum
while niggas < 50:
print("Ran up " + str(niggas) + " times.")
niggas = niggas + 1
if niggas == 50:
break
def recursiveSum(niggas):
if (niggas <= 50):
return niggas
else:
return (niggas + recursiveSum(niggas - 1))
recursiveSum = niggas
print (recursiveSum)