Task 1
Variable Type | Description |
---|---|
bool | This has two possible values, True or False (1 or 0). |
list | An ordered sequence of items. |
set | A group of unordered items that are all different (each is unique). |
float | Positive or negative numbers with decimal points. |
int | Positive or negative whole numbers. |
string | Essentially, a piece of text of any kind. |
Task 2
The following are my answers to the question on naming variables:
- A variable holding the age of someone in years: age_years
- A variable holding a street address: address
- A variable holding the value
True
if someone is a member: is_member - A variable holding a Date of birth: birth_date/birthday
Task 3
8.3: a.py
number1 = "12"
number2 = "34"
print(number1 + number2)
number3 = int(number1)
number4 = int(number2)
print(number3 + number4)
Output
>>> 1234
>>> 46
Task 4
8.4: int.py
float_num = 2.1
int_num = int(float_num)
print(int_num)
assert float_num != int_num
Output
>>> 2