List length and membership test
๐ Scenario: You are organizing a small party and have a list of guests who have confirmed their attendance.You want to check how many guests are coming and whether a special friend is on the list.
๐ฏ Goal: Create a list of guests, count how many guests are coming, check if a special friend is attending, and print the results.
๐ What You'll Learn
Create a list called
guests with the exact names: 'Alice', 'Bob', 'Charlie', 'Diana'Create a variable called
special_friend and set it to 'Charlie'Create a variable called
guest_count that stores the length of the guests listCreate a variable called
is_special_friend_coming that checks if special_friend is in the guests listPrint the number of guests and whether the special friend is coming exactly as shown
๐ก Why This Matters
๐ Real World
Managing guest lists for events or parties is a common task. Knowing how to count attendees and check if important people are coming helps with planning.
๐ผ Career
This teaches basic list handling and condition checking, foundational skills for data processing, user management, and many programming jobs.
Progress0 / 4 steps