TORONTO KIDS COMPUTER CLUB | Friday 16:15 Homework
162

# Friday 16:15 Homework

## 29 JanFriday 16:15 Python Practice – 23.01.27.

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

## 24 JanFriday 16:15 Python Practice – 23.01.20.

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

## 15 JanFriday 16:15 Python Practice – 23.01.13.

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 JanFriday 16:15 Python Practice – 23.01.06.

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

## 14 DecFriday 17:30 Python Practice – 22.12.09.

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

## 07 DecFriday 17:30 Python Practice – 22.12.02.

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

## 30 NovFriday 17:30 Python Practice – 22.11.25.

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

## 23 NovFriday 17:30 Python Practice – 22.11.18.

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 results? ['tigers', 'pandas', 'penguins', 'giraffes'] ['hippos', 'bears'] Question 2： Using split and join function of the list to change string "green,red,yellow,blue," into string: "green...

## 16 NovFriday 17:30 Python Practice – 22.11.11.

Question: Continue modify the war-robot program we made in the class, so that: if enemy’s hp is lower or equal to 0, use msgbox to display message ‘you win’, and the while program finish. it will be the enemy’s turn to strike you back. Enemy can...

## 08 NovFriday 17:30 Python Practice – 22.11.04.

Question 1: Use while loop (NOT for loop) to create the multiplication table program. After asking which table the user wants, ask her how high the table should go. The output should look like this: Sample Input: Which multiplication table would you like? 7 How high do you want to go? 12 Sample Output: Here’s...