Skip to main content

Command Palette

Search for a command to run...

Taking User Input in Python

Published
•1 min read•View as Markdown
Taking User Input in Python
B

I'm Proficient in a variety of Big Data technologies, including AWS, Azure, GCP, Hadoop, Databricks, Pyspark, Sql, Python, Docker, Jenkins, Git/GitHub, Kubernetes, Azure Data Engineering.

In Python, we can take user input directly by using the input() function. This input function gives a return value as a string/character hence we have to pass that into a variable.

Syntax:

variable=input()

But the input function returns the value as a string. Hence we have to typecast them whenever required to another datatype.

Example:

variable=int(input())

variable=float(input())

We can also display text using the input function. This will make the input() function take user input and display a message as well

Example:

a=input("Enter the name: ")

print(a)

Enter the name: Hello

Hello

More from this blog

Untitled Publication

37 posts