Every function and variable starts with a lower-case letter
Print: prints stuff out in the console (Has to be lowercase)
You can print multiple things with only one print function by putting a comma in-between print()
Print is usually used for debugging, so you can see if there is a part of the code that isn’t working
Run Button: Executes the program
Syntax: You have to write the programs very specifically, it’s how the computer reads it
Comment: Stuff that doesn’t run but is just there
Classes: what a specific thing is, examples of classes are strings, integers and decimal numbers
String (Str): A series of letters (have to be in-between ‘ ‘ or ” “)
Integer (Int): Just a whole number
Decimal Number (Float): Just a decimal number/fraction
Variable: Something that holds/stores a value, and they can change
For-loop: does what is indented under it for what is after the “for”
Operators: just plus, minus, multiplication etc.
Conditional tests: tests to see if a certain thing is True
Boolean Values: and, or, not, True, False
If-elif-else statements(Conditionals): If the stuff inside the if-statement is true then execute the base, if it isn’t then if something else is true execute that body, and if none of the if’s or elif’s are true then execute the else-body
List: A list of multiple things, like variable but multiple things inside
While Loop: While something is true do the stuff in the body, used primarily when you don’t know how long the loop is going to be
Break: Stops the loop
Objects: Something that is specific inside of a class
Self: The object, that is used in that singular run
Arguments: What goes into the parentheses in a function
Type(x): Prints out what type the stuff in the parentheses is ex. Bool, int, float etc.
Booleans: Either True or False (remember uppercase first letter)
Compound conditionals: and, or, not
Range(x, y): Defines a range between x and y, can be used in Ex. For loops
Set(): A list but it has no duplicates
Sorted(x): Puts the list/x in alphabetical order
Return(): prints out a value that has been calculated
Ex. If a>b: return(a)
Is sometimes better than print, because return can be used, and then the variable can be changed, but print just prints stuff out in the console
Gives you a value, instead of just doing stuff, it actually calculates the functions, whereas, without return, you wouldn’t get anything as a calculation would happen, but would be able to be printed out.
Convert datatypes:
Str(): to make it a string
Int(): to make it an integer
Float(): to make it a float/decimal number
Range(): used in for-loops usually and it has the range 0 to the number you put in OR
If you put 3 numbers then the first will be the first number, the last will be the maximum value and the last one will be the step (you NEVER get the last number)
Two types of range functions:
Range(n)
Range(low, high, step)
Ex.
Range(10) = 0,1,2,3,4,5,6,7,8,9
Range(2, 10, 2) = 2,4,6,8
Library: when the syntax is like from [BLANK] import [BLANK]
Module: When the syntax is like import [BLANK]
No Responses