This blog post continues on from my previous Programming 102 tasks/challenges.
2.5 Strings As Lists
Task: “On scoreboards, sports teams are sometimes referred to using a contraction of their name, often the first three letters. Can you write some code in order to create a new list, teams_short, containing three-letter contractions of each of the teams in the list, in the same order as they appear in teams?“.
My Solution:

2.8 Implement Count Function
Task: “Can you add a generic count function to this program so that it prints out the number of learners that scored top marks?“.

2.9 Time To Share Your Code
Task: “In the previous challenge you created a function to count the number of occurrences of a number in a list. Then you extended your program to count strings or letters, or used it to find the number of scores in a range.”
My solution:


2.11 Mean, Max and Min
Task: “Choose one of the following functions: mean (average), minimum, or maximum. Think of a real-world scenario where you need to work with data and find the average, minimum or maximum of a list of values. This could be using data that you work with in school, or for a hobby or other interest”.
I decided to use Python’s built in “min” and “max” functions and then created a function to look for an average wage. There are few different types of averages (see https://www.bbc.com/bitesize/articles/z99jpbk). I looked a fictional wages to see the minimum, maximum and average wage.

One thought on “Programming 102 Week 2 Tasks (Python)”
Comments are closed.