python - input

 input

 

 

 

 

 

 

 

 

 

 

 

 

 

 

How the input function works in Python :

  • When input() function executes program flow will be stopped until the user has given an input.
  • The text or message display on the output screen to ask a user to enter input value is optional i.e. the prompt, will be printed on the screen is optional.
  • Whatever you enter as input, input function convert it into a string. if you enter an integer value still input() function convert it into a string. 

 

 

 

if的语句中如果不转换的话,会提示错误:

 

 

 

 

Taking multiple inputs from user in Python

 

 

 

 

 

 

 

 

 

 

 

 

posted @ 2021-10-08 20:17  xman888  阅读(69)  评论(0编辑  收藏  举报