Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (16.4k points)

In the event that I initialized a variable and simply give the name of the variable without 'print' in the interactive mode then it worth will be printed, for instance 

>>>a=10

>>>a

10

>>>

However, in the event that I do this in content, neither the value gets printed nor any blunder is created, for instance, consider the underneath code in a content example.py

a=10

a

In the event that I execute this content, a clear line gets printed and not the value. Why there is a distinction between interactive mode and script mode yield?

1 Answer

0 votes
by (26.4k points)

It's an accommodation highlight. "Show me what this thing is" is a significantly more significant activity in interactive mode than in a program, and it'd get tiring to continue to compose print(repr(...)) constantly. In a program, printing the estimation of each articulation proclamation would all the more frequently be abnormal and expect you to suppress the yield physically, so you need to print things explicitly.

Want to learn python to get expertise in the concepts of python? Join python certification course and get certified

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...