You are on page 1of 1

Ch8-Project work-Sachev Satheesh Kumar

Code 1:
list1 = input("Enter elements of the list separated by space: ")
list1 = list1.split()
list1 = [int(num) for num in list1]
for i in range(1, len(list1)+1):
print("*" * list1[i-1])

Output:
Enter elements of the list separated by space: 7 4 22 3 1
*******
****
**********************
***
*
—-------------------------------------------------------------------------------------------------
Code 2:
list2 = input("Enter elements of the list separated by space: ")
list2 = list2.split()
list2 = [int(num) for num in list2]
for i in range(1, len(list2)+1):
if list2[i-1]>237:
break
elif list2[i-1]%2 == 0:
print(list2[i-1])

Output:
Enter elements of the list separated by space: 8 7 6 5 238
8
6

Enter elements of the list separated by space: 8 5 6 237 10


8
6
10

You might also like