What is a variable.
anything that is able or apt to change, vary, or take on different values.
What is a string & operators
A sequence of characters (letters, numbers, symbols, or spaces) treated as text, typically enclosed in quotation marks
What does Conditional mean?
Answer: Conditional means a feature or statement that alters a execution / running path based on if the condition is true or false
What is the main purpose of adding a function?
To make a set of instructions into a single block so its easier to understand
A student writes this code to greet a user but gets a syntax error: print("Hello, " + name) What did they forget to do before running this line?
They never created or assigned a value to the variable name.
What should a variable not be used for.
ruin code maintainability, introduce security risks, or cause hard-to-track bugs.
What is the short term for string operators
string ops
When do you use conditional
Answer: To have a true or false question or statements.
What is the difference between defining a function and calling a function?
Actually Creates shortcut while calling it out.
Look at this code meant to check if someone can ride a roller coaster: height = 55 if height > 48 print("Enjoy the ride!") What punctuation mark did the programmer forget at the end of the line?
A colon :
What is a short term for the word variable
It is var
what are string operators used for?
They are used to combine compare text data
What do you use conditionals for?
Answer: True or false questions on an exam or a Way ground test, public Q&A’s with only two choices or when on a quiz as a question is multiple choice with only 2 option EX: “Is darkness the absence of light? Yes or No”
What is a function parameter and how does it make a function more flexible?
A parameter is a placeholder variable inside a function that lets you use different pieces of info into the function each time you call it.
A programmer wants a loop to print the word "Hello" exactly 3 times. Instead, the program prints "Hello" forever without stopping. What is the bug? count = 1 while count <= 3: print("Hello")
They forgot to increase count inside the loop (like count = count + 1), so count stays 1 forever.
What symbol represents a value that can change in a program?
A variable
f a program executes the expression "Data" + "Science", what is the resulting value?
“Data Science”
How do you use conditional statements?
Answer: You use them if only the there is a true or false question anything more than that wouldn't be a conditional as it is not only limited to two answers
You write a function called updateHealth. The function updateHealth can be called multiple times from different parts. True or false
Answer; true
A student wants to calculate a total price with a $5 discount. They write: price = 20 discount = 5 total = price + discount What type of bug is this?
A logic error because they added the discount instead of subtracting it.
What is the difference between a local and a global variable?
A local variable is available only within a function or block; a global variable can be accessed throughout the program.
When using the indexing operator to access the very first character of a string, the index number used is always 1?
0
What will happen IF you put a rock in acid water?
Answer:It will cause a chemical reaction, depending on the rock or what type it is. Or how strong the acid is.
A function must be defined in your code before the line that calls it
True or false?
Answer; False
You want to check if a user typed the secret password "pizza". You write: guess = input("Enter password: ") if guess = "pizza": print("Access Granted") Why does this code cause a syntax error?
A single = is only used to assign values to variables.