4th day of python challenges 69-77
This commit is contained in:
4
challenges69-79/challenge-069.py
Normal file
4
challenges69-79/challenge-069.py
Normal file
@@ -0,0 +1,4 @@
|
||||
tuple_list = ('Iraq', 'Jordon', 'Malaysia', 'Turkey', 'Japan')
|
||||
print(tuple_list)
|
||||
choose = str(input('Enter the name of country : ')).capitalize()
|
||||
print(tuple_list.index(choose))
|
6
challenges69-79/challenge-070.py
Normal file
6
challenges69-79/challenge-070.py
Normal file
@@ -0,0 +1,6 @@
|
||||
tuple_list = ('Iraq', 'Jordon', 'Malaysia', 'Turkey', 'Japan')
|
||||
print(tuple_list)
|
||||
choose = str(input('Enter the name of country : ')).capitalize()
|
||||
print(tuple_list.index(choose))
|
||||
choose = int(input('Enter number to show country : '))
|
||||
print(tuple_list[choose])
|
4
challenges69-79/challenge-071.py
Normal file
4
challenges69-79/challenge-071.py
Normal file
@@ -0,0 +1,4 @@
|
||||
sport_list = ['football', 'crossfit']
|
||||
print(sport_list)
|
||||
sport_list.append(str(input('Enter your faviorate sport to add it : ')))
|
||||
print(sport_list)
|
4
challenges69-79/challenge-072.py
Normal file
4
challenges69-79/challenge-072.py
Normal file
@@ -0,0 +1,4 @@
|
||||
subject_list = ['arabic', 'english', 'mathematics', 'chemistry', 'physics', 'biology']
|
||||
print(subject_list)
|
||||
subject_list.remove(str(input('Enter subject that you don\'t like : ')).lower())
|
||||
print(subject_list)
|
7
challenges69-79/challenge-073.py
Normal file
7
challenges69-79/challenge-073.py
Normal file
@@ -0,0 +1,7 @@
|
||||
foods_list = {}
|
||||
for i in range(4):
|
||||
j = i + 1
|
||||
foods_list[j] = str(input('Enter favourite food : '))
|
||||
print(foods_list)
|
||||
del foods_list[int(input('Enter food number to delete it : '))]
|
||||
print(sorted(foods_list.keys()))
|
5
challenges69-79/challenge-074.py
Normal file
5
challenges69-79/challenge-074.py
Normal file
@@ -0,0 +1,5 @@
|
||||
colors_list = ['red', 'yellow', 'blur', 'orange', 'purple', 'black', 'brown', 'green', 'sky', 'gray']
|
||||
print(colors_list)
|
||||
start = int(input('Enter number between 0-4 : '))
|
||||
end = int(input('Enter number between 5-9 : '))
|
||||
print(colors_list[start:end])
|
10
challenges69-79/challenge-075.py
Normal file
10
challenges69-79/challenge-075.py
Normal file
@@ -0,0 +1,10 @@
|
||||
number_list = ['134', '762', '356']
|
||||
for i in number_list:
|
||||
print(i)
|
||||
append_to_list = int(input('Enter number to add to list : '))
|
||||
if append_to_list not in number_list:
|
||||
print('This is not in the list')
|
||||
number_list.append(append_to_list)
|
||||
else:
|
||||
print('This is in the list, could not add')
|
||||
print(number_list.index(append_to_list))
|
9
challenges69-79/challenge-076.py
Normal file
9
challenges69-79/challenge-076.py
Normal file
@@ -0,0 +1,9 @@
|
||||
name_list = []
|
||||
for i in range(3):
|
||||
name_list.append(str(input('Enter name to invite to party : ')))
|
||||
print(name_list)
|
||||
add_more = str(input('Enter more people to party? yes|no : ').lower())
|
||||
while add_more == 'yes':
|
||||
name_list.append(str(input('Enter name to invite to party : ')))
|
||||
add_more = str(input('Enter more people to party? yes|no : ').lower())
|
||||
print(len(name_list))
|
15
challenges69-79/challenge-077.py
Normal file
15
challenges69-79/challenge-077.py
Normal file
@@ -0,0 +1,15 @@
|
||||
name_list = []
|
||||
for i in range(3):
|
||||
name_list.append(str(input('Enter name to invite to party : ')))
|
||||
print(name_list)
|
||||
add_more = str(input('Enter more people to party? yes|no : ').lower())
|
||||
while add_more == 'yes':
|
||||
name_list.append(str(input('Enter name to invite to party : ')))
|
||||
add_more = str(input('Enter more people to party? yes|no : ').lower())
|
||||
print(name_list)
|
||||
name_list_index = str(input('Enter name to show it position in list : '))
|
||||
print(name_list.index(name_list_index))
|
||||
name_list_index_remove = str(input('Would like this person to come to party? yes|no : '))
|
||||
if name_list_index_remove == 'yes':
|
||||
name_list.remove(name_list_index)
|
||||
print(name_list)
|
Reference in New Issue
Block a user