Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wpforms-lite domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/ragipunal.com/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the businext domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/ragipunal.com/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/ragipunal.com/wp-includes/functions.php on line 6114
Python Değişkenlerin Kapsamı - RAGIP ÜNAL

Blog

Python Değişkenlerin Kapsamı

Python Değişkenlerin Kapsamı

Fonksiyon içinde tanımlanan değişkenler sadece o fonksiyon içinde geçerlidir. Fonksiyon dışında çağrıldıkları zaman hata oluşur.

def fakt(n):
    fakt=1
    for i in range(1, n+1):
        fakt*=i
    return fakt

print("6!=", fakt(6))
print("i=", i)
print("fakt=", fakt)


"""
6!= 720
Traceback (most recent call last):
  File "C:/Users/xxx/Python Blog/024_kapsam.py", line 14, in <module>
    print("i=", i)
NameError: name 'i' is not defined
"""

030_fonksiyon.py

Leave A Comment

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir