1
0
forked from tdwojak/Python2017
Python2017/labs04/task01.py
2017-12-16 02:44:01 +01:00

19 lines
627 B
Python

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
def is_numeric(xs):
return all(isinstance(x, (int, float)) for x in xs)
assert is_numeric([1,2,3,4,5,6,6])
assert is_numeric([1.0,2.0,3.0,4.0,5.0,6.0])
assert is_numeric([1])
assert is_numeric([1.0])
assert is_numeric([1.0, 1])
assert is_numeric([1, 1.0])
assert is_numeric([]) #zgodnie z ustaleniami z zajęć
assert not is_numeric([1,2,3,'a',4,5,6,6])
assert not is_numeric([1.0,2.0,3.0,'a',4.0,5.0,6.0])
assert not is_numeric([1, 'a'])
assert not is_numeric([1.0, 'a'])
assert not is_numeric(['a', 1.0, 1])
assert not is_numeric([1, 1.0, 'a'])
assert not is_numeric(['a'])