Sequence Flashcards

1
Q

What is syntax

A

The rules of the language

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

What is sequence

A

Sequence is the default by which

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

What is the purpose of this code?

password = “Azza”
user_password = “”
while user_password != password:
user_password = input(“What is your password)
print(“You got the password right!”)

A

The purpose of this code is checking if the user has entered the right password or not; if the password isn’t correct, then it will keep asking for the password until you get it right and when you do, it will say “Your got the password right!”

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

What is iteration?

A

A piece of code that is looped until it reaches a certain value.

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

What is selection?

A

Pieces of code that run under certain conditions.

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

what is a logic error?

A

occur when there is a fault in the logic or structure of the problem. Logic errors do not usually cause a program to crash

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

What will be outputted?

amazinglist = [“apple”, “banana”, “tomato”]
print(amazinglist[0])

A

“apple”

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

What is the purpose of this code?

amazinglist = [“apple”, “banana”, “tomato”]
amazinglist[1] = “watermelon”
print(amazinglist)

A

Replaces banana with watermelon
Prints the new list

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

word = “word”
print(len(word))

What is the output?

A

4

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

What does casting do:?

A

chnages the data type of a varibale

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