سرگرمی و طنز ورزشی کارتون و انیمیشن علم و فن آوری خودرو و وسایل نقلیه آموزش موسیقی و هنر اخبار و سیاست حیوانات و طبیعت بازی حوادث مذهبی
۱۴۰۵/۰۳/۱۶
#3 Python Programming Exercise

Construct a function that has 1 parameter - the x variable. If x is smaller than 0 then return with 0. Otherwise return with +1. (Note: there may be multiple return statements in a given function)

Good luck!


====================================================


#3 Python Programming Exercise

def activation(x):

if x < 0:
return 0
else:
return 1

=================================================
By the way this is a famous activation function in artificial intelligence and machine learning.



==================================