Saturday, 3 July 2021

Python List and Tuple

 f1=input("Enter the name of fruits 1: \n")

f2=input("Enter the name of fruits 2: \n")
f3=input("Enter the name of fruits 3: \n")
f4=input("Enter the name of fruits 4: \n")
f5=input("Enter the name of fruits 5: \n")
f6=input("Enter the name of fruits 6: \n")
f7=input("Enter the name of fruits 7: \n")
fruit_list=[f1,f2,f3,f4,f5,f6,f7]
print(fruit_list)



marks_student1=input("Enter the marks of student 1:\n")
marks_student2=input("Enter the marks of student 2:\n")
marks_student3=input("Enter the marks of student 3:\n")
marks_student4=input("Enter the marks of student 4:\n")
marks_student5=input("Enter the marks of student 5:\n")
marks_student6=input("Enter the marks of student 6:\n")
marks_lists=[marks_student1,marks_student2,marks_student3,marks_student4,marks_student5,marks_student6]
print(marks_lists)
marks_lists.sort()
print(marks_lists)
print(marks_lists[0])

t=(1,2,3,4,8,10,35,1,1,"upendra")
print(t)
# t[3]=12
print(t.index(10))


l1=["upendra",12,1,45,14.02,True,"harry"]
print(l1)
l1.append(4)
print(l1)


a=[1,45,85,785]
print(a[0]+a[1]+a[2]+a[3])
a[3]=456230
print(a[0]+a[1]+a[2]+a[3])
print(sum(a))


t1=(1,"hello",12,1,0,0,456.2,0,"harry")
print(t1.count(0))

No comments:

Python if / else

 Python if / else a1 = int ( input (" Enter the number: \n ")) a2 = int ( input (" Enter the number: \n ")) a3 = int ( i...