






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Python Python is a general purpose programming language General Purpose can be used for many things Python Creation Year Created in 1991 by Guido van Rossum Popularity of Python Python is so popular that it is the most searched language for coding tutorials accounting for almost 1/3 of all tutorials searched. Function (Math) Math: Function Function (Python) Python: Function Input (Math) Math: Input Argument(s) (Python) Python: Argument(s) Decimal (Math) Math: Decimal Float (Python) Python: Float Whole Number (Math) Math: Whole Number
Integer (Python) Python: Integer String (Python) Python: String Strings any text, whitespace, special characters enclosed in quotation marks (" ") Examples of Strings Examples: "a","abc","Indiana!","101","0.5" Integers whole numbers (numbers without a decimal) Examples of Integers Examples: 0, 20, 101, 2024, - 10 Float number that contains a decimal Examples of Float Examples: 0.5, 3.14159265, 45.7124, 1/2, 5/ Python Print Function Python's print() function prints out what is passed between the () Argument (Print Function) What is passed between the () is called the argument Anatomy of Print Function Print(619.0) 101.0 + 210.0 + 308.0 = 619.0 is the argument which is passed to print() Function a type of procedure or routine that carries out a task Argument a value that is passed to a function
Variable Assignment the process of assigning a value to a variable using the equals sign (=) Data Representation the way data is stored and manipulated in programming, often using variables Example of Variable name = "i101" assigns the value "i101" to the variable called name Examples of Integer 1, - 1, 0, 500, 124954, - 10000 Python Practice exercises designed to reinforce learning and application of Python programming concepts Calculation the process of performing mathematical operations Concatenation An operation that combines two strings together. TypeError An error that occurs when an operation is performed on incompatible data types. Multiplication (*) An operation that repeats a string a specified number of times, where the number is an integer. Addition (+) An operation that performs concatenation for strings. Subtraction (-) An unsupported operation that results in a TypeError when attempted with strings. Division (/) An unsupported operation that results in a TypeError when attempted with strings. int() function A function that converts strings to integers.
str() function A function that converts number data types to strings. Formatting with strings Methods to improve the appearance of output strings, such as adding spaces. Calculation 9 print("Katie" + "Chase" + "Logan") results in 'KatieChaseLogan'. Calculation 10 print("Ashlee" * 3) results in 'AshleeAshleeAshlee'. Calculation 11 print("ai" + name) results in 'aiChristian'. Calculation 12 print("Katie" + 5) results in a TypeError. Backup The act of saving work to cloud storage to prevent data loss. Study Sessions Sessions held by lab instructors to assist students with assignments and understanding material. Functions Blocks of reusable code that perform a specific task. Arguments Values that are passed to a function when it is called. Variables Containers for storing data values. Indexing Accessing individual characters in a string using their position. Slicing Extracting a portion of a string using a range of indices.
Index position to stop at (non-inclusive). Step Select every 1 character, every 2 characters, etc. By default step = 1. Positive Index Indexing that starts from the beginning of the string. Negative Index Indexing that starts from the end of the string. List A useful data type for storing multiple items in one 'box'. Item Each member of a list. List Syntax Lists are denoted by '[ ]'. Index Position in Lists Each item in a list corresponds to an index position starting from 0. Accessing Values in Lists Use square brackets [ ] next to a list to access values at a given index position. Updating Values in Lists To update values in a list use the assignment operator '='. Adding Values to Lists Use the .append function() to add values at the end of a list. Removing Values from Lists Use the .remove function() to remove specific values from a list. Boolean Logic A system of logic that evaluates to True or False. Conditional Actions
Actions that are executed based on whether a condition is True or False. Whitespace Delimited Python language syntax where indentation matters. Boolean Expression An expression that evaluates to either True or False. Conditional Action Example if 5 == 5: print("Looks like 5 equals itself!") Indexing in Boolean Logic Can compare elements indexed or sliced using indexing. Conditional statement Used to perform an action if certain condition(s) are met. len() function Checks the length of a list or string. Append method Adds an element to the end of a list. Remove method Removes an element from a list. Conditional operators Used to compare values, e.g., '==' checks for equality. Assignment operator Used to assign a value to a variable, e.g., '='. Logical operators Allow checking multiple conditions at once, represented with 'and' / 'or'. Else statement Provides a default case if the if statement is not true. Elif statement
if charCount > 15: prints 'There are more than 15 characters'. Backup reminder Be sure to back up all your work to your cloud storage of choice.