+ 1
Print ('enter a no. ') and input ('enter a no. '), both are giving same out put, does that mean I can use either of them?
4 odpowiedzi
+ 12
print ('something') ---> is used to print something between quotes...
while input('something') ---> will be used to take input from user... it will also print something & input provided by user on screen...
so if u want 2 take input from user & print it on screen use input()
+ 6
Yes you can..
0
Can there be a situation where only one of them will give the desired result n not the other one?
0
If your intention is for the user to enter a number, or any input at all, then the best practice is to use input().
If you use a print() you will need to accompany it with an input() anyway, so your code would be not only inefficient but it would be a bad practice.
Regarding your question "Can there be a situation where only one of them will give the desired result n not the other one?": Yes, using print() + input() will add a new line after your text, but using only input() will not.