This is used if the if condition wasn't true
What is else
These are the 4 main types of data
What is a string, a integer, a float, and a boolean
This is the brains of the computer
What is a CPU
You can use this method to display info to the user
What is print
a = 3
b = 4
if a < b:
print("A is greater then B")
The if statement is checking if a is less than b instead of the other way around.
If you want to set something to a value you would use this operator.
What is =
This goes at the end of every if statement
What is a colon (:)
This is a variable with only two possible values
What is a Boolean
This is a volatile form of temporary memory
What is RAM
This method can be used to receive data from the user
What is input
year = 2018
age = input("What is your age")
birth = year - age
print(birth)
age is checking for a string instead of an int
If I want to use floor division I would use this operator.
What is //
This is used for checking a different set of if conditions in the same if chain
What is elif
This variable has an infinite number of values between 0 and 1
What is a float
A magnetic storage drive in computers
What is a Hard Disk Drive
These is used to add an argument to a method
What are parenthesis
1year = 2016
2year = 2018
print(year2 - year1)
You can't start variable names with numbers
If you wanted to have a multi line comment you would use this.
What is ''' and '''
This can be used to check multiple conditions in an if statement
What is and
True or False
There is no limit to what you can name a variable
False
There are a few rules including no spaces and not begining with a number
This is commonly refereed to as the MOBO or mainboard
What is a motherboard
True or False:
Capitalization is not important for methods.
False
Capitalization is incredibly important
James' Pet = "Stanley"
Jessica Loves = James' Pet
print(Jessica Loves)
You cannot have spaces in variable names
These are used to help other programmers understand our code.
What are comments
What does this print
age = 20
year = 2018
birth = year - age
if birth > 1989 and birth < 2000
print("You're a nineties kid")
elif birth > 2000:
print("What up cool dude")
else:
print("What are you")
print("Done")
You're a nineties kid
Done
What is A at the end
a = 6
b = 12
c = 18
if c == 6*3:
a = a + c + b
if b < c - a:
a = a*3
print(a)
A is 36
This this allows power to be sent to the rest of the computer.
What is a PSU
What does this print if the name is John, the flower is Roses and the love is 5
name = input("What is your name")
flower = input("What's your favorite flower")
love = int(input("How much do you love that flower"))
if love == 5:
print(name + " loves " + flower)
else:
print(name + " likes " + flower)
John loves Roses
number = int(input("What is your favorite number")))
print(number)
There is one to many parenthesis on number
These are used to write documentation alongside code that can later be pulled by IDE's, websites, or printed documentation.
What is a Docstring