Core Parts Of Python IDLE | Input() And Output()

Which programs are we said to be good programs, that programs can easily interact with the user to do some tasks. For example, if you do some calculations that programs need input for two values and what operation are you can do addition or subtraction and finally give the output as result. Python is a case-sensitive language. so all keywords should be lower case. This can be done by following functions

  • input()
  • output()

input() Function

In Python, the input( ) function is used to accept data as input at run time. The values can be any data type like strings, lists. Syntax of input() functions

Var = input(“strings”)

In the following example, we saw some examples that depend on input() functions. input() should be in lower case because python is case sensitive.

python virtual example

In the above image, there are three examples for input() with different types.

  • input() – returns all input as a strings
  • int(input()) – only accepts integer values
  • float(input()) – only accepts float values or decimal values

Try more examples, to get a values at runtime using input() function. we know that practice makes a man perfect try more examples and learn more. If you got any errors check the code and recompile.

print() Functions

The print() function is used to see the result as output. The print() displays an entire statement that is specified within print ( ). The comma ( , ) is used as a separator in print ( ) to print more than one item as well as use concatenation to add to strings. for example,

Comments in Python #

In Python, comments begin with a hash symbol (#). The lines that begin with # are
considered as comments and ignored by the Python interpreter. Comments may be single-line or no multi-lines. The multiline comments should be enclosed within a set of ”’ ”'(triple
quotes) as given below

  • #Iterathon Blog
  • ”’ It is a multiline comment which contains more than one line ”’

My Previous Post

Two modes of python: https://iterathon.tech//2-modes-of-python-interactive-and-script-mode/

LEARN LITTLE BY LITTLE TO CHANGE THE TECH WORLD

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *