If you are facing any issue in playing video please use Firefox browser.
Python Print Function, Input and Output In Python 1
In this lecture we will see that,
How print() function works ?
How to read data from keyword ?
Printing on screen
"print()" is use to print on screen.
print(value, ..., sep=' ', end='\n', file=sys.stdout)
Prints the values to a stream, or to sys.stdout by default.
Optional keyword arguments :
sep : string inserted between values, default a space.
end : string append after the last, default a newline.
file : a file-like object (stream); defaults to the current sys.stdout.
For this we will create a new file and name project as 'file.py' and then we will make a source folder in which we will save all our modules.
print("In print function","second value")
In print function second value
from macpath import sep
print("In print function","second value",sep=' ', end=' ',file=sys.stdout)
In print function second value third value
Reading from keyboard
To read data from keyboard "input()" is use.
The input of the user will be returned as a string without any changes.
If this raw input has to be transformed into another data type needed by the algorithm, we can use either a casting function or the eval function.
Have a friend to whom you would want to share this course?