Sequence Flashcards
What is syntax
The rules of the language
What is sequence
Sequence is the default by which
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!”)
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!”
What is iteration?
A piece of code that is looped until it reaches a certain value.
What is selection?
Pieces of code that run under certain conditions.
what is a logic error?
occur when there is a fault in the logic or structure of the problem. Logic errors do not usually cause a program to crash
What will be outputted?
amazinglist = [“apple”, “banana”, “tomato”]
print(amazinglist[0])
“apple”
What is the purpose of this code?
amazinglist = [“apple”, “banana”, “tomato”]
amazinglist[1] = “watermelon”
print(amazinglist)
Replaces banana with watermelon
Prints the new list
word = “word”
print(len(word))
What is the output?
4
What does casting do:?
chnages the data type of a varibale