String Slicing Flashcards

1
Q

text = “Python Programing”

print(text[4:9])

A

on Pr

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

text = “Python Programing”

print(text[:5])

A

Pytho

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

text = “Python Programing”

print(text[:-2])

A

Python Programi

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

text = “Python Programing”

print(text[-2:])

A

ng

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

text = “Python Programing”

print(text[-5:-3])

A

am

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

text = “Python Programing”

print(text[:-5])

A

Python Progr

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

text = “Python Programming”

print(text[4:91])

A

on Programming

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

text = “Python Programing”

print(text[:])

A

Python Programming

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

text = “YoU’re wELCome”

text.capitalize()

A

You’re welcome

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

text = “YoU’re wELCome”

text.lower()

A

you’re welcome

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

text = “YoU’re wELCome”

text.title()

A

You’Re Welcome

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Explain:

text. isdigit()
text. isalpha()
text. isalnum()

A
  • isdigit: string are digits
  • isalpha: string are alphabetic
  • isalnum: digits or alphabetic
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

text = “Python Programing”

print(text[::2])

A

Pto rgaig

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

text = “Python Programing”

print(text[::-1])

A

gnimargorP nohtyP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly