0

Can someone tell me what's the difference between ,,print" and ,,input"

5th Sep 2016, 4:00 AM
Erikas Kupsys
Erikas Kupsys - avatar
6 Respuestas
+ 6
Both print and input are built in functions. print function displays the given message on the screen. For example. print ("Hello") gives output as Hello Whereas input function accepts given data. For example, input = "Enter your age :" shows output as Enter your age and when you enter your age and press enter it takes in your age. you can store that age into a variable and retrieve it later for further use.
5th Sep 2016, 6:38 PM
Veluri Reddy
Veluri Reddy - avatar
+ 4
Simply brother! input is used for taking something(i.e., int ,float,string) and output is used for giving something(i.e., int ,float,string). :)
13th Sep 2016, 6:27 AM
SATYAM PRASAD TIWARI
SATYAM PRASAD TIWARI - avatar
+ 1
@Luc, Okay so I was also confused about this a minute ago but I think I got it now. So print() function simply shows you/displays on the screen whatever arguments you pass it. So for example, if I want my compiler to display “Enter your name” on my screen, I will simply use print(“Enter your name”) which will give me an output of “Enter your name”. That's it. I won't be able to input a value after this or anything. It simply displays the phrase “Enter your name” and moves on. On the other hand, the input() function allows you to input a value in the form of a string. So, if I type input(“Enter your name: “), my compiler will give me “Enter your name: “ which allows me to **INPUT **my name, say “Sharon” and then outputs “Sharon as my name. Also, try your hands on it. It will stick better.
16th Aug 2020, 6:37 PM
Sharon Essilfie
Sharon Essilfie - avatar
0
OK thx that helped
5th Sep 2016, 6:41 PM
Erikas Kupsys
Erikas Kupsys - avatar
0
I get that "input" takes something and "print" outputs something...but the difference is still really unclear. If I type "input(7)" I get an output of 7. If I type "print(7)" I get an output of 7. I could define variables to place in "print()" and "input()" and combine them in ways to get the same output. So it's really not clear to me when or why I would use input in a sequence of steps. I guess, when should I absolutely NOT use input but print, instead? When should I absolutely NOT use print but use input, instead? This is probably really dumb but I'm just trying to see the advantage /disadvantage of ever using one or the other. would I maybe use "input" somewhere in the middle of a sequence, after defining the initial value of certain variables? (Like when telling the program, after such and such steps, to input a certain value or formula for something else?)??? Hope I just answered my own question but it's annoying me.
25th Jun 2020, 3:18 AM
Luc Josts
Luc Josts - avatar
0
I still do not get it can someone please help?
16th Aug 2020, 6:04 PM
Sharon Essilfie
Sharon Essilfie - avatar