TORONTO KIDS COMPUTER CLUB | Sunday 12:00 Homework
106

# Sunday 12:00 Homework

## 06 AugSunday 16:00 Python Homework 08.04

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

## 11 DecSunday 12:00 Python Homework 12.09.

Question: Using function or object method to write a program to return the number of times that the string "code" appears anywhere in the given string, except we'll accept any letter for the 'd', so "cope" and "cooe" count. For example: 'aaacodebbb' will have 1 "code" 'codexxcode' will have 2 "code" 'cozexxcope'...

## 04 DecSunday 12:00 Python Homework 12.02.

Question: Write a Python program (either use function or object method) to check the validity of password input by users. Validation : At least 1 letter between [a-z] and 1 letter between[A-Z]. At least 1 number between [0-9]. At least 1 character from [\$#@]. Minimum length 6...

## 28 NovSunday 12:00 Python Homework 11.25.

Question: Create an object WordReverse to reverse a string. You need one argument (which is the original string) to create the object. def __init__(self, word): You need one method to reverse the string def reverse(self): You can print the object with the following expected output...

## 20 NovSunday 12:00 Python Homework 11.18.

Question 1. Write a short program to generate a list of five random integer numbers from 1 to 20, and print them out. Question 2. Write a short program that prints out a random decimal number every 3 seconds for 30 seconds. Hint: You need import module time. time.sleep(5) means wait 5 seconds Bonus...

## 12 NovSunday 12:00 Python Homework 11.11.

Question： Create an OunceConversion object to convert any number of fluid ounces to the equivalent number of gallons, quarts, pints, and gills. (There are 128 fluid ounces in a gallon. There are 32 fluid ounces in a quart. There are 16 fluid ounces in a pint. There are 4 fluid...

## 06 NovSunday 12:00 Python Homework 11.04.

Question： Create a Tank object which have the attributes of: name direction(up/down/left/right) x position and y position The Tank object also have a method: move (direction, steps) Using __init__ to Initial the tank to make sure it start from x position of 0 and y position of 0 Print out...

## 30 OctSunday 12:00 Python Homework 10.28.

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

## 24 OctSunday 12:00 Python Homework 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 which...

## 16 OctSunday 12:00 Python Homework 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...