Manipulating variables | You can change the case of a string, or convert an integer to a string or string to an integer. Concatenation involves joining strings together in the order they appear using the + operator | Variables Try It | |
Pattern programming | Practice syntax and coding by creating patterns. Try to print a 5 x 5 square with asterisk (*) characters using only one print instruction. Put a space in between each asterisk. | Python picture programming in Trinket | |
Number operators | There are a number of symbols used to perform math operations. | Number operators Try It | |
Input | The input function asks the user for a value and returns the result. Concatenation can be used to combine input responses with other phrases | Input Try It | |
Conditionals | An if statement runs specific instructions if a certain condition is True. An else statement runs the indented instructions if the condition of the if statement above it is False | < | Conditional Try It |
Lists | A list is a datatype used to store a collection of different pieces of information, in order, under a single variable name. It is enclosed in square ([]) brackets, elements separated by commas. | Lists Try It | |
Loops | code that repeats for a certain number of times, or while something is true | Loops Try It | |
Looping through lists | Loops let you process all the data in a list | Loops and lists Try It | |
Functions | a sequence of instructions that performs a specific computation. A function can take inputs and produce outputs. | Functions Try it |
Manipulating variables: Variables store data. Integers are written as numbers, words are written as strings in quotation marks You can combine variable inputs and strings with quotation marks.Input lets the user interact with the program. |
Variables Try It | |
Conditionals check if a certain condition is True. They are written with if, elif and else statements. An if statement has has colon after it and the instructions are indented. An if statement allows values in your program to control whether certain instructions are performed. An elif statement checks its condition if no previous condition was True.An else statement runs the indented instructions if the condition of the if and elif statements above them are False. | Conditionals Try It | |
Loops: The while loop repeats a block of instructions as long as a given condition is True. Each repetition is called an iteration of the loop. To end the loop, the condition should eventually become False. For the condition above, each iteration of the loop should increment the variable so it eventually reaches the maximum value. For loops iterate over items in a list. | Loops Try It | |
Functions are a sequence of instructions that performs a specific computation. A function can take inputs and produce outputs. The computational task that a function performs must first be defined. A function is defined with the def keyword. After def, give a unique name to the function, and add a sequence of indented instructions on the following lines. | Functions Try It |
After you have reviewed these basic concepts, continue some more advanced examples on the Python Practice Page