(7 Points) : ISC3U Test Unit 4 and Unit 5 Part A
(7 Points) : ISC3U Test Unit 4 and Unit 5 Part A
PART A
[7 points]
Write down each of the following words next to its definition below: float, input, int, len, print, raw_input, str
[3 points]
Give three examples of an illegal variable name, and explain why each is illegal. You can only use a given reason once.
__________ __________________________________________________________________________
__________ __________________________________________________________________________
__________ __________________________________________________________________________
[3 points]
What is the result of the following two expressions?
x[-3:] ____________________________________
[2 points]
Describe the two ways you can write comments in Python:
PART B
[5 Points]
In the space below, write Python code which demonstrates a semantic error. Be sure to include a comment explaining
the error.
[15 Points]
In the space below, write a well-commented Python program which prompts a user to enter his/her name, and each of
the last six grades (in percentages) from last semester. You should calculate his/heroverall average, and display the
following type of output:
*****************************************************
* Hi Marie! *
* Your average this semester was: 82.4% *
*****************************************************
BONUS
[5 points]
In your own words, describe what the following Python statement will do
print ("*"*len(raw_input()))[:]