Looks like no one added any tags here yet for you.
How do you print the same text multiple times?
By using a * and a number
eg. Print(“Gyat” * 3)
What are the 4 main variable types
integer - whole numbers (eg 1, 2, 3)
float - decimal points (eg 1.0, 2.5, 3.69)
string - text (eg hello world)
boolean - true or false
What must you be careful when using if else statements?
There is a colon (:) (and therefore indentation)
What is the difference between , and + when using the print function?
A comma will cause a space between the values vbeing printed whereas a + will cause them to print directly next to eachother
How do you limit the number of decimal points in Python?
By using the round fucntion (literally “round()”) or %.f
What is the difference between / and // (arithmic)
/ will give a float while // gives an intiger
What does % do (arithmic)
Gives the remainder of the devision
What is the difference between * and **
* multiplies while ** makes it to the power
How do if, elif and else statements work together?
If condition 1 is true
do…
elif condition 2 is true ( and 1 is false)
do…
else (both condition 1 and 2 false)
do…
What does the “not” opetation do?
Converts boolean variables to the opposite (E.g true=flase)
What is the greater/less than or equal to sign in python
>= / <=
What does the len() function do?
Gives the number of characters
How do i make an input not case sensetive
lowercase_input = user_input.lower()
(The variable is equal to the previous input but it is not all lower case, the same can be done with .upper())
When using the print function, what foes f before quotation marks do?
print(f”text”) allows for variables to be placed inside the quotation marks as lond as they are in {curlyBrackets}
what does != mean?
not equal to ( while != “pink”, do …)
What is the difference between the first codes?
The second code with the indentation will print the total each time it adds a number while the first code will print the sum of all the numbers
Will x or y reach 1 first?
y (will reach 1 first)
How do you make a system that will print the highest number?
(using a nested loop)
What are the 2 ways to check if a number is in the list?
The ‘in’ operator - will provide a boolean value (true/false)
Or using .index - will provide the first location of the number (eg if the number comes up twice in a list it will only show the first location)
What is the difference between lists and tuples
Tuples cant be ammended
What is the shorthand was of (image)
x,y,z = coordinates
What is def used for in python? and how would it be used
To define a function, will allow a function to be “used” whenever the variable name is called upon
What do the peramiters in def() do?
They act as variables, which have to be given a value
What is the except function used for?
To help debug code/ prevent if from crashing
What are classes used for in python?
To define new types
What is PascalCase
A naming convention where every first letter of the word is capitalised
How do you make a class inherit all the code from another class?
class newVariable(inheritingVariable)
What are modules used for?
To organise code into multiple sections