TORONTO KIDS COMPUTER CLUB | Friday 20:30 Homework
158

# Friday 20:30 Homework

## 07 DecFriday Python Practice 20:30 – 22.12.02

Question: A common problem in mathematics is to determine which quadrant a given point lies in. There are four quadrants, numbered from 1 to 4, as shown in the diagram below: For example, the point A, which is at coordinates (12, 5) lies in quadrant 1 since...

## 30 NovFriday Python Practice 20:30 – 22.11.25

Question: You are given a string . Suppose a character ‘a’ occurs consecutively n times in the string. Replace these consecutive occurrences of the character ‘a’ with (n, ‘a’) in the string. Input Format:  A single line of input consisting of the string . Output Format: A single line of...

## 23 NovFriday Python Practice 20:30 – 22.11.18

Question: Write a function luckySum(a, b, c) to calculate sum of given 3 int values, a b c. The function will have a return value of their sum. However, if one of the values is 13 then it does not count towards the sum and values to its...

## 16 NovFriday Python Practice 20:30 – 22.11.11

Question: Given the list of student marks: marks = [62, 84, 74, 51, 98, 73, 77, 90, 85, 79, 65, 58, 74, 86] Write a function that takes in a list of arguments and then returns a list containing marks which are above average. Name the function whatever you like...

## 31 OctFriday Python Practice 20:30 – 22.10.28

Question: The factorial function (symbol: !) says to multiply all whole numbers from our chosen number down to 1. Examples: 4! = 4 × 3 × 2 × 1 = 24 7! = 7 × 6 × 5 × 4 × 3 × 2 × 1 = 5040 1! = 1 Factorial is not defined for...

## 24 OctFriday Python Practice 20:30 – 22.10.21

Question： The Body Mass Index (BMI) is one of the calculations used by doctors to assess an adult’s health. The doctor measures the patient’s height (in meters) and weight (in kilograms), then calculates the BMI using the formula: BMI = weight / (height * height) Write a program...

## 17 OctFriday Python Practice 20:30 – 22.10.14

Question 1：(please use function that return a value) Write a program to display information to a driver based on his/her speed according to the following table: km/h over the limit Fine 1 to 20 \$100 21 to 30 \$270 31 or above \$500 Sample Input 1: Enter the speed limit: 40 Enter the recorded speed of the...

## 12 OctFriday Python Practice 20:30 – 22.10.07

Question: write a program to ask user about the date(year, month and day), then calculate the day of the year. Sample input： Year: 2016 Month: 6 Day: 23 Sample output： Day of the year: 175 Hint: You need consider leap years and non leap years, in order to do easier calculation, you may create...

## 04 OctFriday Python Practice 20:30 – 22.09.30

Question： Write a program to ask the user for five names. The program should store the names in a list, and print them all out at the end. It should look something like this: Sample input： Enter 5 names: Tony Paul Nick Michel Kevin Sample output： The names are Tony, Paul, Nick, Michel, Kevin Hint: You can use...

## 27 SepFriday Python Practice 20:30 – 22.09.23

Question： Create a list called “attributes” , it contains “HP”, “Attack”, “Defense”, “Special Attack”, “Special Defense”, “Speed” Modify the list above, replace “Special Attack” and “Special Defense” with “Magic” and “Stamina” Add “Special skills” in the end of the list Delete “Speed” from the list. ...