TORONTO KIDS COMPUTER CLUB | Saturday 12:00 Homework
103

Saturday 12:00 Homework

11 DecSaturday 12:00 Python Homework 12.08.

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 DecSaturday 12:00 Python Homework 12.01.

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 NovSaturday 12:00 Python Homework 11.24.

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

19 NovSaturday 12:00 Python Homework 11.17.

Import practice: 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...

12 NovSaturday 12:00 Python Homework 11.10.

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 NovSaturday 12:00 Python Homework 11.03.

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 OctSaturday 12:00 Python Homework 10.27.

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

22 OctSaturday 12:00 Python Homework 10.20.

Question： Please write a program using function. Each player in a tournament plays six games. There are no ties. The tournament director places the players in groups based on the results of games as follows: if a player wins 5 or 6 games, they are placed...

15 OctSaturday 12:00 Python Homework 10.13.

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