Revision w6-w15 Flashcards
assignment operator
=
To define a variable you must ..?
The name of the variable
The initial value of the variable
Any words that are reserved for special
purposes in a computer language
Reserved words
Name Python’s data types:
int, float, string, complex numbers and Boolean
True or False?
The data type is associated with the value, not the variable
True
Is Python a dynamically or statically typed language?
Python is a dynamically typed language, in other words, the
variables data type can change during runtime
num=1
str=’s’
num2=2
satuation1: num + s
satuation2: num + num2
what is the output?
1: error
2: 3
Can a constant value change?
Yes
Is Python a interpreted or compiled language?
Python is an interpreted language —it does not use a compiler.
What is the difference between ‘/’, ‘//’ and ‘%’?
/ --> prints float //--> (Floor division) discards the fractional part % --> (modulus division), return the remainder
What is the difference between ‘*’ and ‘**’?
- –> multiplication
* * –> power
The values passed to the function.
Arguments
What are the four ways to import sqrt() from math:
1- from math import sqrt
2- import math –> math.sqrt()
3- import math as m –> m.sqrt()
4- from math import ∗ (imports all functions, but it is not recommended)
Formatting:
age = 18
num=1
print( f “Im { age } today ” )
print(f“ Cost {age + num}”)
Formating
look w-8a Page-8 to 11 VERY IMPRTANT INFO