Programming with Python

⌘K
  1. Home
  2. Docs
  3. Programming with Python
  4. Introduction to Python
  5. Input and Output

Input and Output

Input

  • Input is data entered by user in the program
  • input( ) function is available for input

Syntax

variable = input(“data”)

Example

>>> x=input("Enter your name")
Enter your name Raji
>>> y = int(input("Enter any number"))
Enter any number4
>>> type(y)
<class 'int'>
>>> type(x)
<class 'str'>

Output

Output can be displayed to the user using print statement

Syntax

print(expression / constant / variable)

Example

>>> print("Hello")
Hello
>>> print(5)
5
>>> print(5+2)
7
>>> x = 3
>>> print(x)
3

Loading

Views: 3

How can we help?

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments