Lesson 10: Lists
Post date: Jan 18, 2019 4:03:20 PM
names = ["Kayden"]
names.append("Soham")
names.append("Jerry")
names.append("Kian")
names.append("Mahin")
names.append("Anshay")
names.append("Karthik")
names.append("William")
names.append("Sumedh")
names.append("Yahia")
print(names)
for name in names:
print("Hello", name, "!!!")
print("There are", len(names) - 1, "students in the class!")
print(names[0])
names.insert(2, "Attila")
print(names)
if "Mahin" in names:
print(names.index("Mahin"))
print(names[names.index("Mahin")])
names.sort()
print(names)
names.sort(reverse=True)
print(names)
import random, time
print(.9**20)
length = len(names)
for i in range(length):
select = random.randint(0, len(names)-1)
print(names[select], "stand up!!!")
names.remove(names[select])
time.sleep(3)