1.py

principal = 100 # $100 rate = 0.04 # 4% time = 2 # 2 years ### PART A: Calculate the simple interest ### i will earn after 2 years, using ### the formula: ### interest = principal * rate * time ### PART B: Print the amount of interest ### i have earnt to the screen ### PART C: Add the amount of interest earnt ### to the principal, and print this ### value to the screen as well.

2.py

answer = "Grant Hackett" question = "Who won the men's 1500m freestyle at the 2000 Sydney Olympics?" guess = input( ### something here ### ) # Question: ask the question, and input an answer from the user. # If the answer is correct, say "Correct", otherwise say "Incorrect".

3.py

magic_word = "please" answer = input("What do you say if you want a treat?") while ### something here ###: answer = input("Try again. What do you say for a treat?") ### Question: make this loop until the user answers "please"

4.py

# % symbol gives the remainder # for example: # 10 % 3 = 1 # 5 % 3 = 2 # 42 % 9 = 6 import random number = random.randint(1,10) remainder = number % 2 odd_or_even = "" # Question: code the following functionality # which tells me if the number is odd or even: # if the remainder is 0: # set odd_or_even to "even" # else: # set odd_or_even to "odd" print("Number:", number) print("Remainder:", remainder) print("Odd or even:", odd_or_even)

5.py

# A bus can take 40 students (total). # The number of students (currently) on each bus: bus1 = 38 bus2 = 35 bus3 = 12 remaining_students = int(input("How many students remaining? ")) # Question 1: Keep all remaining students together on one bus: # If all remaining students can fit on bus1, # print a message to send them all to bus1. # If all remaining students wont fit on bus1, but will fit on bus2, # print a message to send them all to bus2. # If all remaining students wont fit on bus2, but will fit on bus3, # print a message to send them all to bus3. # If all remaining students wont fit on a bus3, # print a message saying "Not enough room on any bus for you all". # ---------------------------------------------------------------- # Question 2 (extension): Break up the remaining students, so that # the load is shared amongst the three busses, filling up bus1 first, # then bus2, then bus3, then print any students left as "left behind". # For example: # How many students remaining? 23 # bus1: 40 # bus2: 40 # bus3: 28 # left behind: 0 # Or: # How many students remaining? 52 # bus1: 40 # bus2: 40 # bus3: 40 # left behind: 17