forked from LKnopf/Python_precourse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHW1.py
40 lines (29 loc) · 1.08 KB
/
HW1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# fill the python code
# 1. assign an integer to the variable x
# 2. assign the content of x to the variable y
# 3. increase the content of x by 13
# 4. decrease the content of y by 3
# 5. assign an empty list to the variable z
# 6. put x and y in this list
# 7. run this file in Python3 and make sure no error occurs
# 8. push this file in your repository
x = 5
y = x
x = x + 13
y = y - 2
z = []
z.append(x)
z.append(y)
if __name__ == '__main__':
assert type(x) is int, '1. x is not an integer'
# assert y is x, '2. y is not assigned to the content of x'
assert type(x) is int, '3. x is not an integer anymore'
assert type(y) is int, '4. y is not an integer anymore'
assert type(z) == list, '5. z is not a list'
assert len(z) <= 2, '6. list length is too long'
assert len(z) >= 2, '6. list length is too short'
assert type(z[0]) == int, '6. first element in the list is no integer'
assert type(z[1]) == int, '6. second element in the list is no integer'
print('Congratulations, homework successfully solved!')