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 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 Klavye'den Bilgi Girişi - Input Function - RAGIP ÜNAL

Blog

Python Klavye’den Bilgi Girişi – Input Function

Klavye’den bilgi girişi yapmak için input fonksiyonunu kullanacağız. İşte basit bir input fonsiyonu örneği,

>>> a=input("LÜTFEN, BİR RAKAM GİRİNİZ...")
LÜTFEN, BİR RAKAM GİRİNİZ...6
>>> print(a)
6

Ama dikkat diyelim, input ile girilen değer string türündedir. Mesela a değişkenine 3 ekleyip ekrana yazdıralım.

>>> b=a+3
Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    b=a+3
TypeError: Can't convert 'int' object to str implicitly

Gördüğünüz hata mesajını aldık. Çözüm ise basit string değeri int türüne dönüştürdükten sonra toplama işlemini kolaylıkla yapabileceğiz.

>>> b=int(a)+3
>>> print(b)
9

Sonunda istediğmiz sonuca ulaştık.

Fark ettiyseniz ekrana yazdırmak istediğimizde print() fonksiyonunu kullandık. Python 2 kullanmış olsaydık parantezleri kullanmamış olurduk. Fakat Python 3 de parantezlerle kullanılmak zorundadır.

Leave A Comment

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