how to read input from stdin in python

import sys
data = sys.stdin.readline()
sys.stdout.write('Dive in')

Here is what the above code is Doing:
1. It’s reading a line of input from the user.
2. It’s writing a line of output to the user.
3. It’s exiting the program.

You can also use the input() function to read a line of input from the user.

The input() function will read a line of input from the user and return it as a string.

If you want to read an integer, you can use the int() function to convert the string to an integer.

If you want to read a floating-point number, you can use the float() function to convert the string to a floating-point number.

Here’s an example: