Signifies that something is equivalent to something else
= =
Known as counting loops
For Loops
Known as conditional loops
while loops
A loop that never exits
Infinite Loop
Used to countdown by 1 in a loop
Used to tell Python to skip the rest of the statements in the current loop block and to go on to the next iteration of the loop.
continue
A one-line statement that means "exit the current loop
break
Repeats code a fixed number of time
For Loop
Checks to see if loop_condition is True. If it is, it will loop again, if not, if false, loop will stop.
While Loop
A control flow tool used as a second condition check after an if statement.
elif
Repetition of instructions a specified number of times, or until a condition is met
Iteration
the expression that decides whether the if statement or loop is going to continue being executed or not
condition
Lets you enter just the starting and ending values, and it creates all the values in between for you.
range()
Adding two strings together using the "+" operator
concatenation
Control structure that lets us do either one section of code or another depending on a test
If Else Statement
lets you ask a question to the program and only run code if the answer is true
If Statement
Ohappen when you make an error in the syntax of your program. Syntax errors are like making grammatical errors in writing.
Parse Error
Your program executes but then stops due to some type of exception (something bad) happened
runtime error
It will run successfully in the sense that the computer will not generate any error messages. However, your program will not do the right thing. It will do something else
Semantic Error
Caused almost always when you have used a variable before it has a value.
a = 25
b = 40
Write an if/else statement to print two statements, one if a is greater than b and a second if it's not. Be sure to use correct format.
a = 25
b = 40
if a > b:
print something
else:
print something else
The variable should print out that you need to eat..
hungry - true
while hungry:
print("I need to eat")
hungry = FalseCreate a for statment to print a range of numbers between 1 and 7
for i in range(1,7):
print i
Create an if statement for an input statement called season asking the user to enter their favorite season. If there favorite season is summer, print let's go swimming, if there favorite season is spring, print everything is turning green, if there favorite season is not one of the above, print I prefer the warmer weather.
season = input("What is your favorite season")
if season == "summer":
print let's go swimming,
if season == "summer":
print ("Let's go swimming!")
elif season == "spring":
print ("Everything is turning green!"),
else:
print ("I prefer the warmer weather")
Occurs when you you try to combine two objects that are not compatible.
For example you try to add together an integer and a string.
Type Error