-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path16_practice_set_of_chptr4.py
More file actions
36 lines (30 loc) · 918 Bytes
/
Copy path16_practice_set_of_chptr4.py
File metadata and controls
36 lines (30 loc) · 918 Bytes
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
# wap to store 7fruits in a list entered by a user
fruits=[]
f=input("enter first fruit name ")
f1=input("enter second fruit name ")
f2=input("enter third fruit name ")
f3=input("enter fourth fruit name ")
f4=input("enter fifth fruit name ")
f5=input("enter sixth fruit name ")
f6=input("enter seventh fruit name ")
fruits=[f1,f2,f3,f4,f5,f6]
print(fruits)
# wap to accept marks of 6 students and display them in sorted order
s1=int(input("enter marks of stud1 "))
s2=int(input("enter marks of stud2 "))
s3=int(input("enter marks of stud3 "))
s4=int(input("enter marks of stud4 "))
s5=int(input("enter marks of stud5 "))
s6=int(input("enter marks of stud6 "))
stud=[s1,s2,s3,s4,s5,s6]
stud.sort()
print(stud)
# wap to sum a list of 4 no.
l1=[11,22,33,44]
print(l1[0]+l1[1]+l1[2]+l1[3])
# or
print(sum(l1))
# wap to count no. of zeroes in the following tuple
# a=(7,0,8,0,0,9)
a=(7,0,8,0,0,9)
print(a.count(0))