Programming Rock, Paper, Scissors Part 2 OALH

Last updated over 3 years ago
22 questions
1

What is a variable?

1

What is the convention for naming variables?

1

What is an f-string used for?

1

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

1

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

1
Draggable itemCorresponding Item
Real/float
False
Boolean
"Hello"
Char
"a"
String
5.2
Integer
283
1

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

Now run the following code in trinket below
1

What data type is being collected at line 2?

1

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

1

Why do you think this is?

1

Does Python have a function for char?

1

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

1

Why do you think this happens?

1

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

1

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

1

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

1

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

1

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

1

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?

1

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

1

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

1

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