Skip to content

MacleansCollegeCodingClub2024/Beginners-Problems-5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

Beginners-Lists

Beginner's Problems based on Python Lists.

Starter: Biggest, Smallest and Average Here’s a list of numbers: numsList = [7, 6, 23, 8.18, 18, 8, 7.2, 85, 915, 12]

Output the biggest number, the smallest number and the average of all the numbers. For the biggest and smallest numbers, also output the position they are at in the list.

Same Start and End: Here’s a list of strings: stringsList = [“abc”, “123”, “2332”, “aBBA”, “heelloo”, “1212”, “DcEfD”]

Output the number of strings that have the same character at the start and end. In this problem, ‘A’ and ‘a’ are the same characters (technically)

Hint: strings are a list of characters.

I Like Pesto (a lot): 8 people have decided to let you know what their favourite food is. You will ask each of them what their favourite food is and if their favourite food is ‘pesto’ add it to a list called ‘iLikePesto’. If it’s a different food, add it to a list called ‘otherFoods’. Print the number of ‘pesto’ mentioned in iLikePesto, print ‘I like pesto’ for that number of times and print the list of the other foods.
Input Example
What’s your favourite food? Pesto
What’s your favourite food? Chicken
What’s your favourite food? Pesto
What’s your favourite food? Toast
What’s your favourite food? Waffles
What’s your favourite food? Pesto
What’s your favourite food? Chocolate
What’s your favourite food? Pesto

Output Example
Pesto is loved by 4 people!
I like pesto
I like pesto
I like pesto
I like pesto

Other Foods:
Chicken
Toast
Waffles
Chocolate

List of (good) Cereals: Allow the user to input a cereal. If the cereal is not ‘sultana and bran’ or ‘weetbix’, then add the cereal to a list called ‘cerealList’. (Doesn’t matter if there’s double-ups of cereal) Once the user inputs any of the very much hated cereals, end the program and output cerealList.
Input Example
Enter Cereal: Cheerios
Enter Cereal: Nutri Grain
Enter Cereal: Cinnamon Toast Crunch
Enter Cereal: Corn Flakes
Enter Cereal: Weetbix

Output Example
[‘Cheerios’, ‘Nutri Grain’, ‘Cinnamon Toast Crunch’, ‘Corn Flakes’]

About

Beginners Problems on Python Lists

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published