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ş'


Quiz

Answer the questions to check your understanding.

This lesson includes a short quiz.

Lesson discussion

Swap insights and ask questions about Python Temel

Be the first to start the discussion

Ask a question or share your thoughts about this lesson.