19 lines
627 B
Python
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']) |