TORONTO KIDS COMPUTER CLUB | Wednesday 17:00 Homework
152

# Wednesday 17:00 Homework

## 26 JunWednesday 17:00 Python Practice – 22.06.22.

Question: Use input() to take 10 input from user, each item is separated by space. Then try to complete the following task: Create a list from the input Delete all repeated elements of the list. Sample Input 1: 1 2 3 2 1 3 98 98 67 Sample Output...

## 21 JunWednesday 17:00 Python Practice – 22.06.15.

Question: write a program to ask user about the date(year, month and day), then pass these year month and day as arguments to a function calcDay that return 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...

## 14 JunWednesday 17:00 Python Practice – 22.06.08.

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...

## 05 JunWednesday 17:00 Python Practice – 22.06.01.

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...

## 29 MayWednesday 17:00 Python Practice – 22.05.25.

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...

## 21 MayWednesday 17:00 Python Practice – 22.05.18.

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...

## 13 MayWednesday 17:00 Python Practice – 22.05.11.

Question 1: Make a function that will allow you to print any name, address, street, city, state or province, zip or postal code, and country in the world. (Hint: It needs seven arguments. You can pass them as individual arguments or as a list.) Question 2: Write a function to calculate the total value of some...

## 08 MayWednesday 17:00 Python Practice – 22.05.04.

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 in alphabetical order at the end. It should look something like this: Sample input： Enter 5 names: Tony Paul Nick Michel Kevin Sample output： The names are Kevin, Michel, Nick,...

## 03 MayWednesday 17:00 Python Practice – 22.04.27.

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. ...

## 24 AprWednesday 17:00 Python Practice – 22.04.20.

Question： Using split and join function of the list to change string "green,red,yellow,blue," into string: "green light* red light* yellow light* blue light* " Hint: >>> vegetables = "carrots, potatoes, onions, leeks, celery" >>> # string.split(separator) will split the string by separator, for example: >>> vegetables = vegetables.split(", ") >>> print(vegetables) ['carrots', 'potatoes', 'onions',...