Python Tutorials for AP Computer Science Principles, updated at May 10, 2024
|
Python Listsupdated at May 10, 2024![]() Lists are used to store multiple items in a single variable.Lists are one of 4 built-in data types in Python used to store collections of data, ![]() |
Python String Operationsupdated at May 10, 2024![]() You can return a range of characters by using the slice syntax.Specify the start index and the end index, |
Python Variablesupdated at May 10, 2024![]() Variables are containers for storing data values.Creating Variables.Python has no command for declaring a variable.A variable is created the moment you first assign a value to it.Variables do not need to be declared with any particular type, |
Python Data Typesupdated at May 10, 2024![]() In programming, |
Python Setsupdated at May 09, 2024![]() Sets are used to store multiple items in a single variable.Set is one of 4 built-in data types in Python used to store collections of data, |
Python Tuplesupdated at May 09, 2024![]() Tuples are used to store multiple items in a single variable.Tuple is one of 4 built-in data types in Python used to store collections of data, ![]() |
Python Dictionariesupdated at May 09, 2024![]() Dictionaries are used to store data values in key:value pairs.A dictionary is a collection which is ordered*, ![]() |
Python While Loops/For Loopsupdated at May 09, 2024![]() The while Loop.With the while loop we can execute a set of statements as long as a condition is true.The while loop requires relevant variables to be ready, ![]() |
Python Functionsupdated at May 09, 2024![]() A function is a block of code which only runs when it is called.You can pass data, ![]() |
Python Arraysupdated at May 09, 2024![]() Arrays are used to store multiple values in one single variable: Access the Elements of an Array.You refer to an array element by referring to the index number. .The Length of an Array.Use the len() method to return the length of an array (the number of el... |
Python Iteratorsupdated at May 09, 2024![]() An iterator is an object that contains a countable number of values.An iterator is an object that can be iterated upon, |
Python Modulesupdated at May 09, 2024![]() What is a Module?.Consider a module to be the same as a code library.A file containing a set of functions you want to include in your application.Create a Module.To create a module just save the code you want in a file with the file extension .py:Use a Mod... |
String concatenation by join()created at Jun 14, 2023![]() Write the code for a Python function expand(x) that takes a list of strings, |