You guys are in here for a treat. This is one of the essential tutorials to use Python interpreter, IDLE efficiently.
And we will also tell you how IT companies update code and we are going to use the same process in python exercises.
We hope that you have already done with python installation and are eager to understand how to use it. We had already explained to you how to invoke IDLE, and we are going to continue ahead.
Python Interpreter:
The three greater than sign (>>>) that you see when you start IDLE is telling us that Python interpreter is started.
Python Interpreter converts our code into machine language for the computer to understand what we are asking it to do.
It can just interpret the code at runtime and let us know what is going on here. I work on Read evaluate print loop.
It takes the command and either evaluate something or print the result and then it waits for the next command.
Our suggestion, have fun with it. It is one of the best calculators you can get.
Use of Python Interpreter:
There will be a time when you will be confused at what function or a piece of code does. At that time interpreter can be used to check the code.
If someone asks you a question, don’t say, “I don’t know.” Instead say, “lets us try that in Interpreter.” In this way, you can never be wrong.
If you are smart Python interpreter will make you smarter.
Python IDLE:
When it comes to small code interpreter is good. But when you are writing big programs, you can’t just depend on the interpreter, as it is hard to debug.
You will need something more efficient, and you might do not want to save the series of commands or big programs. For that, we are going to use IDLE files.
Step 1: Click on the File menu and click on New File. A new file will be created
Step 2: Edit the code in the new file, and save it to your local directory
Step 3: When you want to execute it save the file and press F5. The code will be executed in the interpreter.
You can always come back to file to change it or start from the last update. That is the benefit of using IDLE files.
Python Practice Exercise:
To start with any python exercise, follow the following steps.
Step 1: Download the file to your local system. Click on file to downloaded it on your system.
Step 2: Right-click on file, and select the option
Edit with IDLE > Edit with IDLE 3.6 (32 - bit)/(64 - bit)
Step 3: There will be instructions in comments. Follow them strictly.
Comments will also tell you what output you must expect once you run the code.
Step 4: Update the code and save the file. Press F5 to run the program.
Step 5: Check the output of your code and expected output in comments. Update the code as many times as needed to get the correct output.
And if at any point you feel that you want to start afresh, download the file again from Go4Expert. This is the actual process in IT companies, and we are preparing you for it.
Good Luck!!! And Keep Working hard
Key Takeaways:
- Use Interpreter as a calculator, and to check little code snippets.
- Use IDLE file for large programs and to store commands for later use.
- Keep practicing with python exercise and remember you may have to reiterate.
- Don’t worry!! You will also have answers for programming exercises, but not in that tutorial.