-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtraining_functions.py
More file actions
20 lines (18 loc) · 918 Bytes
/
Copy pathtraining_functions.py
File metadata and controls
20 lines (18 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#findout what this actually does
def sum_test(a,b):
if a==b:
return (2*(a+b))
else:
print(b)
return a+b
# The exercise comes first (with a few extras if you want the extra challenge or want to spend more time), followed by a discussion. Enjoy!
# Ask the user for a number. Depending on whether the number is even or odd, print out an appropriate message to the user. Hint: how does an even / odd number react differently when divided by 2?
# Extras:
# If the number is a multiple of 4, print out a different message.
# Ask the user for two numbers: one number to check (call it num) and one number to divide by (check). If check divides evenly into num, tell that to the user. If not, print a different appropriate message.
def isEvenOrOdd(n):
if n%2==0:
return print("this is n%2== true")
# else:
# print(n%2)
# return #print("n is not even ")