Want to make creations as awesome as this one?

Transcript

START

QUIZ ABOUT

String Handling

What is an example of String Handling?

Checking the length of a variable

A

Converting functions to procedures

B

Joining strings and variables together

C

Initializing a String variable

D

1

1 100 POINTS

2 200 POINTS

3 400 POINTS

4 800 POINTS

5 1.600 POINTS

6 3.200 POINTS

7 6.400 POINTS

8 12.800 POINTS

9 25.600 POINTS

10 50.000 POINTS

GOODLUCK!

START OVER?

1 100 POINTS

2 200 POINTS

3 400 POINTS

4 800 POINTS

5 1.600 POINTS

6 3.200 POINTS

7 6.400 POINTS

8 12.800 POINTS

9 25.600 POINTS

10 50.000 POINTS

WRONG!

String handling is used to examine passwords and to ensure that they are of an acceptable strength. How can you convert a string into a fully lowercase or uppercase ?

.Low() and .Upper()

A

.low() and .up()

B

.lower and Upper

C

.lower() and .upper()

D

2

1 100 POINTS

2 200 POINTS

3 400 POINTS

4 800 POINTS

5 1.600 POINTS

6 3.200 POINTS

7 6.400 POINTS

8 12.800 POINTS

9 25.600 POINTS

10 50.000 POINTS

RIGHT!

START OVER?

1 100 POINTS

2 200 POINTS

3 400 POINTS

4 800 POINTS

5 1.600 POINTS

6 3.200 POINTS

7 6.400 POINTS

8 12.800 POINTS

9 25.600 POINTS

10 50.000 POINTS

WRONG!

What is the easiest way to count how many times a certain value appears within a string?

.char()

A

.counter()

B

.count()

C

.times()

D

3

1 100 POINTS

2 200 POINTS

3 400 POINTS

4 800 POINTS

5 1.600 POINTS

6 3.200 POINTS

7 6.400 POINTS

8 12.800 POINTS

9 25.600 POINTS

10 50.000 POINTS

RIGHT!

START OVER?

1 100 POINTS

2 200 POINTS

3 400 POINTS

4 800 POINTS

5 1.600 POINTS

6 3.200 POINTS

7 6.400 POINTS

8 12.800 POINTS

9 25.600 POINTS

10 50.000 POINTS

WRONG!

We use the len command to see how many characters are in a string. It is sensible to save the result of the function into a variable so it can be used later.

length = fruit.len()

A

length = len.fruit

B

length = len(fruit)

C

length = lenght(fruit)

D

4

1 100 POINTS

2 200 POINTS

3 400 POINTS

4 800 POINTS

5 1.600 POINTS

6 3.200 POINTS

7 6.400 POINTS

8 12.800 POINTS

9 25.600 POINTS

10 50.000 POINTS

RIGHT!

START OVER?

1 100 POINTS

2 200 POINTS

3 400 POINTS

4 800 POINTS

5 1.600 POINTS

6 3.200 POINTS

7 6.400 POINTS

8 12.800 POINTS

9 25.600 POINTS

10 50.000 POINTS

WRONG!

Use the ? command to split a string into separate words.

.split (",")

A

.split (variable)

B

.separate(",")

C

.separate (variable)

D

5

1 100 POINTS

2 200 POINTS

3 400 POINTS

4 800 POINTS

5 1.600 POINTS

6 3.200 POINTS

7 6.400 POINTS

8 12.800 POINTS

9 25.600 POINTS

10 50.000 POINTS

RIGHT!

START OVER?

1 100 POINTS

2 200 POINTS

3 400 POINTS

4 800 POINTS

5 1.600 POINTS

6 3.200 POINTS

7 6.400 POINTS

8 12.800 POINTS

9 25.600 POINTS

10 50.000 POINTS

WRONG!

Spot the errorname = input("Enter a name: ")if name.startswith("L") = True: print("I like that name.")

missing colon

A

missing equals

B

missing brackets

C

missing speechmarks

D

6

1 100 POINTS

2 200 POINTS

3 400 POINTS

4 800 POINTS

5 1.600 POINTS

6 3.200 POINTS

7 6.400 POINTS

8 12.800 POINTS

9 25.600 POINTS

10 50.000 POINTS

RIGHT!

START OVER?

1 100 POINTS

2 200 POINTS

3 400 POINTS

4 800 POINTS

5 1.600 POINTS

6 3.200 POINTS

7 6.400 POINTS

8 12.800 POINTS

9 25.600 POINTS

10 50.000 POINTS

WRONG!

Spot the errorlength = len(password) if length >= 8 print("Password accepted!")

capital letter

A

missing colon

B

missing bracket

C

missing speechmark

D

7

1 100 POINTS

2 200 POINTS

3 400 POINTS

4 800 POINTS

5 1.600 POINTS

6 3.200 POINTS

7 6.400 POINTS

8 12.800 POINTS

9 25.600 POINTS

10 50.000 POINTS

RIGHT!

START OVER?

1 100 POINTS

2 200 POINTS

3 400 POINTS

4 800 POINTS

5 1.600 POINTS

6 3.200 POINTS

7 6.400 POINTS

8 12.800 POINTS

9 25.600 POINTS

10 50.000 POINTS

WRONG!

Guess the outputname = "sebastian"print(name[::-1])

naitsabes

A

s ebastian

B

sebastia n

C

seb astian

D

8

1 100 POINTS

2 200 POINTS

3 400 POINTS

4 800 POINTS

5 1.600 POINTS

6 3.200 POINTS

7 6.400 POINTS

8 12.800 POINTS

9 25.600 POINTS

10 50.000 POINTS

RIGHT!

START OVER?

1 100 POINTS

2 200 POINTS

3 400 POINTS

4 800 POINTS

5 1.600 POINTS

6 3.200 POINTS

7 6.400 POINTS

8 12.800 POINTS

9 25.600 POINTS

10 50.000 POINTS

WRONG!

Guess the output if input is Sarahname = input("What is your name?")x = len(name)print (name [0:3])print(name[x-3:x])

Sar S

A

rah 5

B

rah Sarah

C

Sar rah

D

9

1 100 POINTS

2 200 POINTS

3 400 POINTS

4 800 POINTS

5 1.600 POINTS

6 3.200 POINTS

7 6.400 POINTS

8 12.800 POINTS

9 25.600 POINTS

10 50.000 POINTS

RIGHT!

START OVER?

1 100 POINTS

2 200 POINTS

3 400 POINTS

4 800 POINTS

5 1.600 POINTS

6 3.200 POINTS

7 6.400 POINTS

8 12.800 POINTS

9 25.600 POINTS

10 50.000 POINTS

WRONG!

What do you need to succeed in Computer Science?

Repeat to yourself: "I am bad at coding"

A

Practice and Confidence - you can all do it!

B

Give up TIME exercises

C

Do not write programming notes

D

10

1 100 POINTS

2 200 POINTS

3 400 POINTS

4 800 POINTS

5 1.600 POINTS

6 3.200 POINTS

7 6.400 POINTS

8 12.800 POINTS

9 25.600 POINTS

10 50.000 POINTS

RIGHT!

START OVER?

1 100 POINTS

2 200 POINTS

3 400 POINTS

4 800 POINTS

5 1.600 POINTS

6 3.200 POINTS

7 6.400 POINTS

8 12.800 POINTS

9 25.600 POINTS

10 50.000 POINTS

WRONG!

YOU WIN!

50.000 POINTS

1 100 POINTS

2 200 POINTS

3 400 POINTS

4 800 POINTS

5 1.600 POINTS

6 3.200 POINTS

7 6.400 POINTS

8 12.800 POINTS

9 25.600 POINTS

10 50.000 POINTS

WELL DONE!

BACK