-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.py
More file actions
101 lines (62 loc) · 1.52 KB
/
functions.py
File metadata and controls
101 lines (62 loc) · 1.52 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Functions
# print("Hello World")
# print("Hello World")
# print("Hello World")
def hello_world():
print("Hello World")
print("Hello World")
print("Hello World")
hello_world()
def nyumba(name):
print(name)
print(name)
print(name)
nyumba("Paul")
nyumba("Mwanza")
nyumba("Felix")
nyumba("Elvis")
def num(nambari):
print(nambari)
print(nambari)
print(nambari)
num(56)
def num1(fname):
print(fname + " is my favorite person")
num1("Paul")
def students(first_name, last_name, ):
print(first_name + " " + last_name + " please enter your name")
students("Paul", "Gichuki")
def employees(first_name, age):
if age < 20:
print(first_name + ", you are below 20 years old.")
elif age <= 30:
print(first_name + ", you are middle aged.")
else:
print(first_name + ", you are older than 30 years old.")
employees("Paul", 18)
employees("Gichuki", 10)
def age_calculator(age):
new_age = age + 10
return new_age
calculated_age = age_calculator(20)
print(calculated_age)
print(age_calculator(17))
print(age_calculator(25))
def performance_calculator(*subjects):
total = sum(subjects)
return total
perf = performance_calculator(45, 34)
print(perf)
student2 = performance_calculator(39, 91)
print(student2)
student3 = performance_calculator(68, 87, 67)
print(student3)
def cost(*purchase):
total = sum(purchase)
return total
purchase1 = cost(1, 200)
print(cost(1, 200))
def ongeza(x):
return x * x
ongeza = ongeza(5)
print(ongeza)