Font size
WorksheetsPython Magic
Total questions: 35
Worksheet time: 24mins
The syntax of a programming language is...
the rules of the language
a group of variables and costants
a command
Python is case sensitive
True
False
White space is used as part of the language syntax
True
False
A string is a collection of characters
True
False
print () is used to:
print strings or do simple maths
cast an integer to a string
print coloured text
To concatenate 2 or more strings with print () you need to use
""
=
&
+
The method to cast an integer to a string is:
("Hello, World")
STR()
\n
The method to add a new line to a string is:
\n
\L
+
=
What is a input?
A function that allows us to ask the user to enter some data.
To plug in something.
Data displayed on a screen.
A function
What is a output?
A piece of data that is shown on the screen.
Data that the user enters
An output
A orange
What function is used to output a message in python?
print("")
input=name
name=input
What is a variable?
Holds data that may change.
It outputs data.
It stores data.
It inputs data.
What is pseudocode?
A planning tool that resembles code but is not code used for humans.
Syntax code
A programming language.
A pastry.
name = 'Dave'
print (name)
What does the '#' allow you to do?
Repeat code
Comment on code
Print code
End code
What data type is a in this code : a = "5"
integer
float
boolean
string
What command do we use to tell Python to accept an input?
cin
input()
scanf()
<>
x=10
if x>11 or x==10:
print ("hello")
error
x is less than 11
hello
10
Choose the correct answer: 5!=3
if 3 greater than 5
if 5 is not equal to 3
if 5 is equal to 3
if 5 greater than 3
Choose the correct answer: 5==3
if 5 is not equal to 3
if 5 is less than 3
if 3 is less than 5
if 5 is equal to 3
Choose the correct answer: 5<=3
if 5 is greater than 3
if 5 is equal to 3
if 5 is not equal to 3
if 5 is less or equal to 3
What will the output be from the following code?
a = 30
b = 55
if b > a:
print("b is greater than a")
else:
print("a is greater than b")
b is greater than a
b
a
a is greater than b
What will the output be from the following code?
x = 10
if x > 0:
print(x+3)
else:
print(x-3)
x+3
x-3
13
7
... is a decision between two things.
if / else statement
if statement
statement
comparison operators
