Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Input

  • Bazen kullanacağımız değeri kullanıcıdan almak isteyebiliriz. Bunu input metodu ile yapacağız
  • input un içinde yazacağımız bize kullanıcıya gösterilecek yazıyı verecek, kullanıcıdan girdi bekleyip enter'a basmasını bekleyecek, ve girdiyi string olarak döndürecek
x = input("Bir sayı girin:")

Bir sayı girin:10

x + 10
---------------------------------------------------------------------------

TypeError                                 Traceback (most recent call last)

<ipython-input-51-dacbb30d0a09> in <module>
----> 1 x + 10
TypeError: can only concatenate str (not "int") to str
type(x)

str

int(x) + 10

20

x = int(input("Bir sayı girin:"))
Bir sayı girin:10
x + 10

15

mesaj = input("Mesajı girin:")

Mesajı girin:Merhaba

isim = input("İsim girin:")

İsim girin:Ulaş

mesaj + " " + isim

'Merhaba Ulaş'