ITlec Prelims pt1 Flashcards
Who created python?
Guido Van Rossum
When was python created?
1991
What is python used for?
web development (server-side),
software development,
mathematics,
system scripting.
Whenever you are done in the python command line, you can simply type __________ to quit the python command line.
exit()
*indicate a block of code.
Indentations
Comments start with a ______, and Python will render the rest of the line as a comment
#
A _________ is created the moment you first assign a value to it.
variable
Rules of variables
- Must start with letter or underscore
-can’t start with number
-can only contain alpha numeric and underscore
There are three numeric types in Python:
*int
*float
*complex
is a named place in the memory where a programmer can store data and later retrieve the data using the variable “name”
variable
You can change the contents of a variable in a later statement
T or F
T
We assign a value to a variable using the ________?
Assignment statement (=)
Order of operation for python
Pemdas
Parenthesis
Exponent
multiplication, division, and remainder
Addition subtraction
(from left to right)
When writing code - use __________
parenthesis
You can also use str() and float() to convert between strings and integers
True or False
False
int() and float()
you will not get an error if the string does not contain numeric characters while converting to int or float
T or F
F
You will get an Error
used to output variables
print()
execution of code statements (one line after another) – like following a recipe
Sequential
used for decisions, branching – choosing between 2 or more alternative paths.
Selection
used for looping
repetition
Recall that Python has a type called __________, which can take two possible values, True and False
boolean
An expression that evaluates to a true/false value is called a
Boolean expression
Python, decisions are made with the ___________, also known as the __________________.
if statement
selection statement
If the boolean expression evaluates to TRUE, then the block of statement(s) inside the if statement is executed. If boolean expression evaluates to FALSE, then the first set of code after the end of the if statement(s) is executed
T or F
T