x

Python Input and Output version3

PREV     NEXT

Python Input and Output version3:

What is Output?

Output is nothing but displaying the data on the monitor or any output device, then we can call it as output.


What is Input?

Input is nothing but reading the data from the keyboard or any input devices, then we can call it as input.

Output:

  • New print format is introduced in Python 3.x version
  • “print” function can be used for displaying the data on monitor or console
  • The difference between version 2.x and version 3.x is, parenthesis is not used in version 2.x, but parenthesis is used in version 3.x

Below are the different ways we can use print function in version 3.x

  • The basic syntax for print function is “print (‘statements’). print syntax is used to print the every statement in new line.

  • Below is the syntax to print the multiple statements in single line. To print the multiple statements, we need to separate each statement with comma ‘,’


  • To print the different types of variables and constants,

  • To Print the variable data with respect to format specifier,

Input:

  • Python 3.x version does not support raw_input() function

  • Python 3.x Version supports input () function

input ():

input() function is also used to read the input from the keyboard. But, the difference between raw_input() and input() functions is, variable will be considered as string by default even if it’s not type casted in raw_input(). But, in input(), it will be type casted automatically with respect to input.

PREV     NEXT



Like it? Please Spread the word!