0
Can someone tell me what's the difference between ,,print" and ,,input"
6 Answers
+ 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.
+ 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). :)
+ 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.
0
OK thx that helped
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.
0
I still do not get it can someone please help?