Link to the previous post : https://statinfer.com/104-1-1-introduction-to-python-and-ide-for-python/
We will be using Spyder as our python environment.
Spyder-Editor
This is where you write the code
- To execute the code, select and hit Ctrl+Enter.
- You can load old code files.
- Code written in this editor is saved in .py format.
- You can hit the tab button to see the autofill options on objects and function names.
- You will be spending most of your time on editor.
Spyder-Console
- This is where the code will be executed when you hit Ctrl+Enter in editor.
- Helps us in code testing and debugging.
- Helps us to avoid errors in the source code at the development phase itself.
- Its usual practice to write a chuck of code in editor then execute it and see if it is working well or not.
- You can toggle between Console and IPython Console.
Spyder – Variable explorer
- Shows all the variables that are created in the current session.
- Helps in physically checking the presence of objects that are created.
- Shows a quick summary of type of object, size, length, sample values etc.,
- We can run the code and see the objects getting created, also we can validate the data type and size of the object.
Basic Commands in Python
Before you code
- Python is case sensitive.
- Be careful while using the Variable names and Function names.
- Sales_data is not same as sales_data
- Print() is not same as print()
Basic Commands
In [1]:
571+95
19*17
print(57+39)
print(19*17)
print("Data Vedi")
# use hash(#) for comments
#Division example
34/56
Out[1]:
Basics-What an error looks like?
In [2]:
Print(600+900)
#used Print() instead of print()
576-'96'
The next post is about Python objects.
Link to the next post : https://statinfer.com/104-1-3-python-objects/