KIIT Polytechnic logo Students Hub KIIT Polytechnic ସାଇନ୍ ଇନ୍
▲ବୋର୍ଡ ◆ନୋଟ୍ସ ≡ସିଲାବସ୍ ▦ଟାଇମଟେବଲ୍ ?ସନ୍ଦେହ ▶ରିଲ୍ସ 🎮ଶିଖନ୍ତୁ 🐍କୋର୍ସ ◈ସୁଯୋଗ ✍ବ୍ଲଗ୍ ▮ଷ୍ଟୋର୍ ★ଟିମ୍ ⌕ଖୋଜନ୍ତୁ
← Learn to Code — Python for Beginners ମଡ୍ୟୁଲ୍ · Storing Information

Getting input from the user

So far your programs only ever do the same thing. input() lets a program ask a question and wait for an answer — try the starter code below, it will actually pop up a real prompt box.

name = input("What is your name? ")
print("Hello, " + name)

Whatever gets typed is stored in name as text. The + here glues two pieces of text together — this is called concatenation.

One catch: input() always gives you text, even if someone types a number. If you need to do maths with it, convert it first using int():

age = input("How old are you? ")
age = int(age)
print(age + 1)