Topic 1 - Python Fundamentals Flashcards
“Print” is known as a ____ in python
Function
In python, what is “ 2 + 2” known as?
An expression
What is required to make an expression in Python?
Expression = values + operators
List the order of operations
- ) Parentheses
- ) Exponents
- ) Multiplication / Division
- ) Addition / Subtraction
DATA TYPES:
- A whole number is known as what in python?
An Integer or “ints”
DATA TYPES:
- A number with a decimal point is known as what in python?
A float
DATA TYPES:
- Standard text in python is known as what?
Strings
- Adding two strings together using a plus symbol is known as what in python?
String concatenation
If you wanted to repeat a string multiple times, you would use “string replication”.
How would you write “Alice” three times?
“Alice” * 3
Describe what a variable is?
A variable is like a box that can store a value, such as a number.
What function would you use to find the length of a variable and what would it return?
len(my_name)
It would return an integer value.
What is input() in the following code example known as in python?
name = input()
A function
Why might you have to call the “str” function on an integer
In a print statement, you may need to convert between data types, such as converting a integer to a string.
How can you convert a string of “1234” into an integer.
Use the function - int(“1234”)
What will happen if you try concatenate an integer and a string?
Example - 27 + “years old”
This would produce an error. The solution would be to first convert the integer to a string.