The input () function in Python

Python's built-in input () function allows users to enter data, convert it into a string, and return the entered content.

Python's built-in input () function allows users to enter data, convert it into a string, and return the entered content.

Input function syntax ()

 input([prompt]) 

Parameter of input function ()

input () has a unique parameter:

  1. prompt : is a string entered by the user.

For example

1. Input () method works in Python

 # nhận input từ người dùng inputChuoi = input() print('Chuỗi đầu vào là:', inputChuoi) 

Suppose the input user input is "Website TipsMake.com". Run the program, the result is:

 Website TipsMake.com Chuỗi đầu vào là: Website TipsMake.com 

2. Receive input from user with prompt before entering.

 # nhận input từ người dùng inputChuoi = input('Nhập chuỗi:') print('Chuỗi đầu vào là:', inputChuoi) 

Result:

 Nhập chuỗi: Website TipsMake.com Chuỗi đầu vào là: Website TipsMake.com 

See also: Built-in Python functions

You've just finished reading the article "The input () function in Python" edited by the TipsMake team. You can save the-input-function-in-python.pdf to your computer here to read later or print it out. We hope this article has provided you with many useful tech tips and tricks. You can search for similar articles on tips and guides. Thank you for reading and for following us regularly.

« PREV : How to update...
The ord () function... : NEXT »