Python Flashcards
What it is the syntax for a print statement when using a variable
print(variable name)
What it is the syntax for a print statement when using a string
print(“string”)
what is the command for the user to input data
input()
what is the command to allow the user to input a hole number value
int(input())
What is the command for allowing the user to enter a decimal value
float(input())
what are the two types of loop
While loop
For loop
What is the syntax for a while loop
while counter
What is the syntax for a for loop
For counter in range(0,5):
print(counter)
Define Pseudocode
Pseudocode is an informal high-level description of the operating principle of a computer program or other algorithm. It uses the structural conventions of a programming language, but is intended for human reading rather than machine reading.
How is Pseudocode started and ended in a python shell
’’’
’’’
What is the command for calling a function
functionname()
What is string slicing and what is it used for
String slicing is used for either removing locating items in a string
State the commands used in string slicing
x = y[w:z]
Purpose: To extract characters from the middle of a string.
x = y[-z:]
Purpose: To return characters to the right of a string.
x = y[:z]
Purpose: To return characters to the left of a string
Name the nine Logical operators that can be used in if elif and else statements
== equals != does not equal greater than >= greater than or equal to and both conditions must be true or one condition must be true not condition is not true
Name the 7 arithmetic operations
\+ addition - subtraction * multiplication / division ** power of // integer division % modulus (remainder after division)
What is the syntax for creating a list
x = []