1/28
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Casting
The process of converting data from one data type to another
Casting on input
Casting user input into int or float so it can be used as a number
Casting on output
Casting non‑string values to strings when concatenating in print statements
Syntax
The grammar rules of a programming language
Mathematical Operators
Symbols used to perform calculations such as + - * / ** // %
Modulus (%)
Operator that returns the remainder after division
Relational operators
Operators that compare two values and return True or False
Boolean
A data type that stores True or False
Boolean Operators
Operators (and, or, not) used to combine or modify Boolean values
Using modulus to check divisibility
Using % to check if remainder is 0 to see if a number divides exactly
Libraries
Collections of extra functions that can be imported into Python
Random library
Provides functions for generating random values
randint
Function that returns a random integer between two values
Math library
Provides mathematical functions like sqrt and constants like pi
sqrt
Function that returns the square root of a number
pi
A precise value of π imported from the math library
Time library
Provides functions related to time, such as pausing execution
sleep
Function that pauses the program for a set number of seconds
If Statements
Code that runs only when a Boolean condition is True
Print Function
Outputs text to the console
Variable
A named memory location that stores a value that can change
Python variable naming rules
Rules: no spaces, cannot start with a number, only underscore allowed as special character
Concatenation
Joining strings together using +
Data types
The format of data stored in a variable (string, integer, float, boolean)
String
A sequence of characters (text)
Integer
A whole number
Float
A number with a decimal point
Input Function
Prompts the user and stores text they enter
Prompt
The message shown to the user when asking for input