2.2.3 additional programming techniques Flashcards

1
Q

what is concatenation

A

adding two or more strings together to form one word by using +
eg.
print(hello+world) returns helloworld

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

how to find if a substring is in a string

A

name = “Riana Dutta”
containsrianasubstring = “Riana” in name
print(containsrianasubstring)

if it prints true riana is in the name

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

can an integer be sliced

A

no
- only strings can

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

how to generate a random number from 1 to 10

A

num = random(1,10)

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