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
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
3
Q
can an integer be sliced
A
no
- only strings can
4
Q
how to generate a random number from 1 to 10
A
num = random(1,10)