Hi Everyone,
Intersting Class I Have Learn Today in BOOLEAN True or False. (true/false) I have use my SIR Teach Me in first letter Uppercase letter use in T and F . ELEVEN QUESTION finish..
CODE:
1) Input: [56, 54, 100, 35, 83, 81, 100, 66, 93, 81, 79, 67, 100, 50, 74, 59, 100, 61, 37, 60]
bucket=0
x=[56, 54, 100, 35, 83, 81, 100, 66, 93, 81, 79, 67, 100, 50, 74, 59, 100, 61, 37, 60]
for i in x:
if i==100:
bucket=bucket+1
print(bucket)
2) Given math scores, find how many scored centum: 100
bucket=1
x=[ "math 70","math 100","math 80", "math 100","math60","math100"]
for i in x:
if i=="math 100":
bucket=bucket+1
print(bucket)
3) Given scores, grade each score: A > 90, B > 80, C > 60, others D
bucket=[]
x=[56, 54, 100, 35, 83, 81, 100, 66, 93, 81, 79, 67, 100, 50, 74, 59, 100, 61, 37, 60]
for i in x:
if i >=90:
bucket=bucket+["grade a "]
elif i >=80:
bucket=bucket+["grade b"]
elif i >=60:
bucket=bucket+["grade c"]
elif i >=50:
bucket=bucket+["grade d"]
print(bucket)
4) Given scores, count students for each grade
bucket=0
students=["sanjay 399","arun 499","parithi 600"]
i=[30,60,85,90]
d=["f","c","b","a"]
x=[30,60,85,90]
for i mark is enumate(x)
if mark<=35:
x[i]="f"
elif mark <=50:
x[i]="d"
elif mark<=60:
x[i]="e"
elif mark<=70
x[]
5) Given numbers, rotate them in place N times [1, 2 , 3 ,4, 5]
x=[1,2,3,4]
y= x.pop()
x.insert(0,y)
print(x)
6) Given numbers, double them in place [1, 2, 3, 4, 5]
-> [2, 4, 6, 8, 10]
bucket=[]
x=[1,2,3,4,5]
for i in x:
bucket.append(i*2)
print(bucket)
7)Sort given numbers
x=[3,9,8,4]
x.sort(reverse=True)
print(x)
8) assending_order in this give number
x=[3,9,8,4]
x.sort()
print(x)
8)given number decending_order
x=[3,9,8,4]
x.sort(reverse=True)
print(x)
9) Sum of given numbers
bucket=[]
x=[1,2,3,4,5,6,7,8,9,10]
for i in x:
bucket=bucket+[i+1]
print(bucket)
10) Find even, odd
bucket=[]
x=[1,2,3,4,5,6,7,8,9]
for i in x:
if i %2==0:
bucket.append((i,"even"))
else:
bucket.append((i,"odd"))
print(bucket)
11) Multiply by 2
bucket=[]
x=[1,2,3,4,5,6,7,8]
for i in x:
bucket.append(i*2)
print(bucket)
CALC:
exit=False
while exit!=True:
option=input("enter a option,add,sub,mul,divi,exit:")
if option=="exit":
exit=True
continue
num1=int(input("enter a number one:"))
num2=int(input("enter a number two:"))
if option=="add":
print(num1+num2)
elif option=="sub":
print(num1-num2)
elif option=="mul":
print(num1*num2)
elif option=="divi":
print(num1/num2)
else:
print("in vaild")
print("calcultor stop")
****************XXX***********************
Top comments (0)