Input And Output In Python

Input And Output In Python

In C language we use scanf and printf for input and output but what about in python? Let's us find out in this post, So hello guys I hope you are doing well, let's discuss about it.

Input And Output In Python

Input Function In Python

Syntax: variable_name = input('text to be displayed')


name = input("Enter your name: ")


Enter your name: Praveen

Input Function For Numbers

To take number as a input you can use int or float outside the paranthesis.

name = int(input("Enter your age: "))


Enter your age: 21

Print Function In Python

Unlike in java where you have to type system.out.println, python has made this built-in function name very simple. Just type print() and inside bracket put the variable, constant or string.

print("Hello World")


Hello World
Load comments