LOOPS AND LISTS IN PHYTHON PRACTICE


#LOOPS
#while loop
i=1
while i <= 10:
    print(i * "*")
    i = i + 1
i=10
while i >= 1:
    print(i * "hello")
    i = i - 1
#for loop
for i in range(10):
   print(i + 1)

#LISTS
marks=[84,56,50,53,55,86]
print(marks[2])
print(marks[-2])
print(marks[0:2])
#for loop in lists
for score in marks:
    print(score)

#addition of extra another subject mark
marks.append(99)
print(marks)
#insesrt in place of append
marks.insert(2,67)
print(marks)
#checking existance of marks in lists
print(50 in marks)
print(97 in marks)
#length of marks
print(len(marks))



 

Comments

Popular posts from this blog

AMAZON HOME PAGE CLONE PROJECT

Array in Javascript

Array in function Javascript