Log in
Sign up for FREE
arrow_back
Library

Programming Rock, Paper, Scissors Part 2 OALH

star
star
star
star
star
Last updated almost 4 years ago
22 questions
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
Question 1
1.

What is a variable?

Question 2
2.

What is the convention for naming variables?

Question 3
3.

What is an f-string used for?

Question 4
4.

Look at the following code
If the input was 14 what would the output be?

Question 5
5.

What would happen if the string “crab” was entered instead of a number?

Question 6
6.
Draggable itemarrow_right_altCorresponding Item
Boolean
arrow_right_alt
False
Real/float
arrow_right_alt
"Hello"
Char
arrow_right_alt
"a"
Integer
arrow_right_alt
5.2
String
arrow_right_alt
283
Question 7
7.

Predict: try to make a prediction about what might happen when this code is executed.

Now run the following code in trinket below
Question 8
8.

What data type is being collected at line 2?

Question 9
9.

Run the program and type more than 1 character when asked for your first initial.
What happens?

Question 10
10.

Why do you think this is?

Question 11
11.

Does Python have a function for char?

Question 12
12.

Run the program and type in some string (text) when you are asked for your age. What happens?

Question 13
13.

Why do you think this happens?

Question 14
14.

Run the program and type in all lower case true when asked if you like marmite. What happens to the marmite message?

Question 15
15.

Run the program and type in True when asked if you like marmite. What happens to the marmite message?

Question 16
16.

Run the program and type in hello when asked if you like marmite. What happens to the marmite message?

Question 17
17.

Line 12 contains the following piece of code likes_marmite == marmite". What do you think might be happening here?

Question 18
18.

Run the program and type 9 when you are asked for your age. What happens?

Question 19
19.

On line 10, the forward slash / is being used between the variable age and the number 10. What arithmetic operation is the forward slash performing?

Question 20
20.

On line 10, change the word float to int. Run the code and type in 9 as your age. What happens?

Question 21
21.

Keeping line 10 as int. Run the code and type in 28 as your age. What happens?

Question 22
22.

What do you think is happening when the number is held as an integer compared to a float?

Use the trinket below to write your rock paper scissors code