1
0
Fork 0

labs04 - task01

Rozwiązanie - Piotr Bystrzycki - nr indeksu 45146
This commit is contained in:
s45146 2017-12-09 20:15:23 +01:00
parent ed8ed03e5b
commit eef90997bc
1 changed files with 15 additions and 0 deletions

View File

@ -1,3 +1,18 @@
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
**ćwiczenie 1**
Napisz funckję ``is_numeric``, która sprawdzi, czy każdy element z przekazanej listy jest typu int lub float.
Wykorzystaj funcję ``isinstance()`` (https://docs.python.org/2/library/functions.html#isinstance).
"""
def is_numeric(my_list):
for item in my_list:
if not (isinstance(item, int) or isinstance(item, float)):
return False
return True and len(my_list) > 0
if __name__ == "__main__":
print(is_numeric([]))