Python .len()

 shopping_list = ["milk", "eggs", "bread", "cheese", "apples"]

# Use len() to find how many items are in the list

print(len(shopping_list))


# Guest list for a party

guest_list = ["Alice", "Bob", "Charlie", "Diana", "Ethan"]


# Find out how many people are on the list

number_of_guests = len(guest_list)


print("Total guests invited:", number_of_guests)

Comments

Popular posts from this blog

Headlines in Arabic

Python .pop

Top AI Advertising Tools