-
Notifications
You must be signed in to change notification settings - Fork 0
/
practiceset4.py
42 lines (37 loc) · 883 Bytes
/
practiceset4.py
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
# Write a program to store seven fruits in a list entered by the user
'''a = []
i = 0
while(i < 7):
a.append(input("Enter a fruit name: "))
i = i+1
print(a)'''
# Write a program to accept the marks of 6 students and display them in a sorted manner
'''a = []
i = 0
while(i<6):
a.append(float(input("Enter the total marks of student: ")))
i = i + 1
a.sort()
print("The list is: ", end="")
print(a)'''
# Check that a tuple cannot be changed in Python
'''a = (1,2,3,4,5)
a.append() = 4
print(a)'''
# Write a program to sum a list with 4 numbers
'''a = []
i = 0
while(i<4):
a.append(int(input("Enter a number: ")))
i = i+1
sum = 0
j = 0
while(j < len(a)):
sum = sum + a[j]
j = j + 1
print(sum)'''
# Write a program to count the number of zeros in the following tuple:
# a = (7, 0, 8, 0, 0, 9)
'''a = (7, 0, 8, 0, 0, 9)
cnt = a.count(0)
print(cnt)'''