Preskoči na glavni sadržaj
Prijava
Sign up for FREE
arrow_back
Biblioteka

Programming Rock, Paper, Scissors Part 2 OALH

star
star
star
star
star
Posljednje ažuriranje over 4 years ago
22 questions
1
1
1
1
1
1
1

Now run the following code in trinket below

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

Use the trinket below to write your rock paper scissors code

Pitanje 1
1.

What is a variable?

Pitanje 2
2.

What is the convention for naming variables?

Pitanje 3
3.

What is an f-string used for?

Pitanje 4
4.

Look at the following code

If the input was 14 what would the output be?

Pitanje 5
5.

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

Pitanje 6
6.
Stavka koja se može prevućiarrow_right_altOdgovarajuća stavka

Char

arrow_right_alt

False

Integer

arrow_right_alt

"Hello"

String

arrow_right_alt

"a"

Boolean

arrow_right_alt

5.2

Real/float

arrow_right_alt

283

Pitanje 7
7.

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

Pitanje 8
8.

What data type is being collected at line 2?

Pitanje 9
9.

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

What happens?

Pitanje 10
10.

Why do you think this is?

Pitanje 11
11.

Does Python have a function for char?

Pitanje 12
12.

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

Pitanje 13
13.

Why do you think this happens?

Pitanje 14
14.

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

Pitanje 15
15.

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

Pitanje 16
16.

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

Pitanje 17
17.

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

Pitanje 18
18.

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

Pitanje 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?

Pitanje 20
20.

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

Pitanje 21
21.

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

Pitanje 22
22.

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