TORONTO KIDS COMPUTER CLUB | Saturday 13:00 Homework
157

# Saturday 13:00 Homework

## 23 NovSaturday 13:00 Python Practice – 22.11.19.

Question 1： Make a class definition for a  BankAccount. It should have attributes for : – its name (a string), – account number (a string or integer), – and balance (a float). It should have methods to: – make deposits with displaying the balance, – and make withdrawals with displaying the balance. Hint: Question 2： Create...

## 16 NovSaturday 13:00 Python Practice – 22.11.12.

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

## 10 NovSaturday 13:00 Python Practice – 22.11.05.

Question 1： Write a program that asks the user to enter his/her name, age, favorite color, and favorite food. Have the program save all four items to a text file called myinfo.txt, each one on a separate line. Question 2： Write a program that asks the user to enter...

## 03 NovSaturday 13:00 Python Practice – 22.10.29.

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

## 27 OctSaturday 13:00 Python Practice – 22.10.22.

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

## 20 OctSaturday 13:00 Python Practice – 22.10.15.

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 OctSaturday 13:00 Python Practice – 22.10.08.

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

## 05 OctSaturday 13:00 Python Practice – 22.10.01.

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

## 28 SepSaturday 13:00 Python Practice – 22.09.24.

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

## 22 SepSaturday 13:00 Python Practice – 22.09.17.

Question 1: We have a list of following: zoo = ['monkeys', 'tigers', 'pandas', 'penguins', 'giraffes', 'hippos', 'bears'] how to retrieve a slice of list zoo, so you can get the following result? ['monkeys', 'pandas', 'giraffes', 'bears'] Question 2: from the same list of zoo in the question 1, how to retrieve...