#!/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(another_list): """ Check whether each element of the list is an instance of int or float :param another_list: :return: True or False """ for i in another_list: if isinstance(i, bool): return False elif isinstance(i, (int, float)): i += 1 else: return False return True # 2nd option # if type(i) in (float, int): # i += 1 # else: # return False # return True # print(is_numeric([2, 1.8797, 43654354354354354354354354354354354325879]))