1
0
forked from tdwojak/Python2017
This commit is contained in:
Ewelina 2017-12-08 21:33:11 +01:00
parent 5ee5fe8c60
commit fbbf379b04

View File

@ -1,3 +1,15 @@
#!/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(x):
if (isinstance(x, int) == True):
return ('obiekt typu int')
if (isinstance(x, float) == True):
return ('obiekt typu float')
print(is_numeric(5.677))