Taking the input from Console of Python
Console in Python : Basically , it is a CLI (command line interface ) which takes input in textual form and execute them . As , python ' s source is interpreted so in that console you just type a instructions and console execute it .
Command line interpreter firstly break the commands in words and take first word as program name and rest as command line arguments and execute them .
if you give a command to the interpreter then , If it is error free then it runs the command and gives required output otherwise shows the error message.
Here we write command and to execute the command just press enter key and your command will be interpreted.
For coding in Python you must know the basics of the console used in Python.
You are free to write the next command on the shell only when after executing the first command these prompts have appeared. The Python Console accepts command in Python which you write after the prompt.
Accepting input form the console : When user enters the value in the console then it takes as the it was required.
We can also typecast this input to integer, float or string by specifying the input() function inside the type.
1.Typecasting the input to Integer: There might be conditions when you might require integer input from user/Console, the following code takes two input(integer/float) from console and typecasts them to integer then prints the sum.
2.Typecasting the input to Float: To convert the input in float type the piece of code is given below.
3.Typecasting the input to String: All kind of input can be converted to string type whether they are float or integer. We make use of keyword 'str' for typecasting.
After successfully converting the type you can recheck them by the type() function
It will show you the type which you are using in your code.
Next Article : Python basic keywords
if you want to learn python for free, here are the top 5 courses available who provide you free python courses
1. Codeacademy: If you like interactive learning, then there is no better place than Codecademy. click here to visit
2. Udemy: like Udemy because you can virtually find a course on anything you want to learn and that too for free. click here to visit
3.Google's python class: Google has its own excellent set of Python tutorials for beginners, known as Google's Python class. This is a free class for people with a little bit of programming experience and who want to learn Python. click here to visit
4.Microsoft's free python course: Like Google , Microsoft also has its own class for Python
click here to visit
5. Coursera: This is the platform from where you can learn python from scrap to advance with the top leading universities. click here to visit
#best online course for machine learning with python
#best python training online
#free online course python data science
#best python learning course online
#best python programming
#python for data science course free
#learn python for data analysis free
#learn python free
#best sites to learn python
#micropython
#python for data science
#data science from scratch
#micropython esp32
#machine learning using python
#matplotlib
#python 3
#scikit learn
#tkinter
#python training
#python data analysis
#best python tutorial
#python classes near me
#learn python for beginners
#python online training
#django course
#advanced python course
#python course fees
#introduction to data science in python
#free python tutorial
#learn python basics
#python study
#python and ai
#python computer science
#learn python step by step
#best course to learn python
#learn python with projects
#python artificial intelligence tutorial
#python training
#python data analysis
#best python tutorial
#python classes near me
#learn python for beginners
#python online training
#django course
#advanced python course
#python course fees
#introduction to data science in python
#free python tutorial
#learn python basics
#python study
#python and ai
#python computer science
#learn python step by step
#best course to learn python
#learn python with projects
#python artificial intelligence tutorial
1 Comments
Great content! Amazing roundups of Python. Keep up the good work. Looking forward to more of it :D
ReplyDeleteIf you have any doubt, Please let me know.