Created
May 29, 2023 02:32
-
-
Save budgetdevv/8e89704c8f0cfa3deb99ab02ff4bfefe to your computer and use it in GitHub Desktop.
Q5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Write your solution (for loop) | |
toppings = ['sprinkles', 'chocolate syrup', 'whipped cream', 'nuts', 'cherries']; | |
# Prompt the user to enter a letter | |
letter = input("Enter a letter to find the first topping starting with that letter: ").lower(); | |
for item in toppings: | |
if (item[0] == letter): | |
print(f"First topping starting with '{letter}': {item}"); | |
break; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment