forked from eyahi/AP-Python-Assignment-MSc-NUN
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKakale (3).py
More file actions
291 lines (199 loc) · 7.16 KB
/
Kakale (3).py
File metadata and controls
291 lines (199 loc) · 7.16 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
#!/usr/bin/env python
# coding: utf-8
# In[14]:
a="Shehu Kakale Tilli"
c = "shehu kakale tilli"
b = "SHEHU KAKALE TLLLI"
print("Hello", a,"i am taking some python classes")
print(b)
print(c)
print(a)
print("Hello", a,"i am taking some python classes")
famous_person = "Godluck Ebele Jonathan once said"
message = '"Small stealing is not a corruption"'
print(famous_person,message)
names = ["Sunshine,","Timi,","Rukayya,","Maryam,","Fatima"]
print(names[0],names[1],names[2],names[3],names[4], )
# In[105]:
graduation = ["Sunshine,","Timi,","Rukayya,","Maryam,","Fatima"]
print("i am inviting",graduation[0],"to our graduation ceremony")
print("i am inviting",graduation[1],"to our graduation ceremony")
grad = "Timi"
print("the guest that can not make is",grad)
graduation[1] = "Hauwa"
print(graduation)
print("i am inviting",graduation[0],"to our graduation ceremony")
print("i am inviting",graduation[1],"to our graduation ceremony")
print("i am inviting",graduation[2],"to our graduation ceremony")
print("i am inviting",graduation[3],"to our graduation ceremony")
print("i am inviting",graduation[4],"to our graduation ceremony")
print("i am here to inform you that i am allow to invite more guest")
graduation.insert(0, "Rabi")
graduation.insert(3, "Aisha")
graduation.append("Salamatu")
print(graduation)
print("i am inviting",graduation[0],"to our graduation ceremony")
print("i am inviting",graduation[1],"to our graduation ceremony")
print("i am inviting",graduation[2],"to our graduation ceremony")
print("i am inviting",graduation[3],"to our graduation ceremony")
print("i am inviting",graduation[4],"to our graduation ceremony")
print("i am inviting",graduation[5],"to our graduation ceremony")
print("i am inviting",graduation[6],"to our graduation ceremony")
print("i am inviting",graduation[7],"to our graduation ceremony")
print("Due to the organazational issues that affected the graduation i am only allow to invite two people")
graduation.pop(0)
print("sorry i cant invite you to graduation",graduation.pop(0))
graduation.pop(1)
print("sorry i cant invite you to graduation",graduation.pop(1))
graduation.pop(2)
print("sorry i cant invite you to graduation",graduation.pop(2))
print(graduation[0],"you are invited to graduation ceremony")
print(graduation[1],"you are invited to graduation ceremony")
print(graduation)
graduation.sort()
print(graduation)
graduation.reverse()
print(graduation)
del graduation[0]
print(graduation)
del graduation[0]
print(graduation)
# In[10]:
def make_album(artist, title):
p_squre = artist
Game_Over = title
return p_square
print()
# In[1]:
cubes = []
for num in range(1,11):
cube = num**3
cubes.append(cube)
print(cube)
cubes_lc = [i**3 for i in range(1,11)]
print(cubes_lc)
# In[2]:
while True:
age = input("Enter your age (type 'quit' to exit): ")
if age.lower() == 'quit':
break # Exit the loop if the user enters 'quit'
age = int(age)
if age < 3:
print("Your ticket is free.")
elif 3 <= age <= 12:
print("Your ticket costs 5000.")
else:
print("Your ticket costs 10000.")
# In[3]:
active = True
while active:
age = input("Enter your age (type 'quit' to exit): ")
if age.lower() == 'quit':
active = False # Set active to False to exit the loop
else:
age = int(age)
if age < 3:
print("Your ticket is free.")
elif 3 <= age <= 12:
print("Your ticket costs 5000.")
else:
print("Your ticket costs 10000.")
# In[ ]:
while True:
age = input("Enter your age (type 'quit' to exit): ")
if age.lower() == 'quit':
break # Exit the loop if the user enters 'quit'
age = int(age)
if age < 3:
print("Your ticket is free.")
elif 3 <= age <= 12:
print("Your ticket costs 5000.")
else:
print("Your ticket costs 10000.")
# In[ ]:
def make_album(artist, title, tracks=None):
album = {'artist': artist, 'title': title}
if tracks:
album['tracks'] = tracks
return album
# Make three dictionaries representing different albums
album1 = make_album('Artist1', 'Album1', 10)
album2 = make_album('Artist2', 'Album2')
album3 = make_album('Artist3', 'Album3', 15)
# Print each return value to show that the dictionaries are storing the album information correctly
print(album1)
print(album2)
print(album3)
# Write a while loop that allows users to enter an album's artist and title
while True:
artist_input = input("Enter the artist (type 'quit' to exit): ")
if artist_input.lower() == 'quit':
break
title_input = input("Enter the album title: ")
# Call make_album() with the user's input and print the created dictionary
user_album = make_album(artist_input, title_input)
print(user_album)
# In[1]:
def show_musicians(musicians):
for musician in musicians:
print(musician)
def make_great(musicians):
great_musicians = [f"Great {musician}" for musician in musicians]
return great_musicians
# List of musicians
musicians_list = ["John", "Paul", "George", "Ringo"]
# Call show_musicians to display original list
print("Original List:")
show_musicians(musicians_list)
# Call make_great function and store the result in a new list
new_list = make_great(musicians_list.copy())
# Call show_musicians to display modified list
print("\nList with 'Great' added:")
show_musicians(new_list)
# Call show_musicians to display the original list again
print("\nOriginal List (unchanged):")
show_musicians(musicians_list)
# In[1]:
alien_color = "green"
if alien_color == "green":
print("Congratulations! You just earned 5 points.")
#### Version Failing the If Test:
# Version Failing the If Test
alien_color = "red" # You can change this to "yellow" for a different failing scenario
if alien_color == "green":
print("Congratulations! You just earned 5 points.")
# In[1]:
alien_color = "green"
if alien_color=="green":
print("congratulation you earned 5 point for shooting the the alien")
# In[6]:
alien_color = "red"
if alien_color=="green":
print("congratulation you earned 5 point for shooting the the alien")
else:
print("congratulation you earned 10 point for shooting the the alien")
# In[2]:
alien_color = "green"
if alien_color=="green":
print("congratulation you earned 5 point for shooting the the alien")
elif alien_color =="yellow":
print("congratulation you earned 10 point for shooting the the alien")
else:
print("congratulation you earned 15 point for shooting the the alien")
# In[1]:
alien_color = "yellow"
if alien_color=="green":
print("congratulation you earned 5 point for shooting the the alien")
elif alien_color =="yellow":
print("congratulation you earned 10 point for shooting the the alien")
else:
print("congratulation you earned 15 point for shooting the the alien")
# In[5]:
alien_color = "red"
if alien_color=="green":
print("congratulation you earned 5 point for shooting the the alien")
elif alien_color =="yellow":
print("congratulation you earned 10 point for shooting the the alien")
else:
print("congratulation you earned 15 point for shooting the the alien")
# In[ ]: