作业的完整代码我放在Github上,可以在我的github中查看。
11-1:城市和国家:
city_functions.py:
1 | def city_country(city, country): |
test_cities.py:
1 | import unittest |
运行:
11-2:人口数量:
1
city_functions.py:
1 | def city_country(city, country, population): |
test_cities.py:
1 | import unittest |
运行:
2
city_functions.py:
1 | def city_country(city, country, population=0): |
test_cities.py:
1 | import unittest |
运行:
3
city_functions.py:
1 | def city_country(city, country, population=0): |
test_cities.py:
1 | import unittest |
运行:
11-3:雇员:
employee.py:
1 | class Employee: |
test_employee.py:
1 | import unittest |
运行: