What is Python

Python is a high-level language, meaning that the source code is intended for humans to understand. Computers, on the other hand, understand only low-level machine code made up of 1’s and 0’s. Programs written in high-level languages must be translated into machine code to run. This translation process can happen all at once, or a little at a time, depending on the language.

Python is an interpreted language: the source code is translated one line at a time while the program is running. The Python interpreter translates source code into machine code and runs the resulting program. If and when an error occurs, the interpreter stops translating the source code and displays an error message.

Most development environments include a Python shell for experimenting with code interactively. A shell, also called a console or terminal, is a program that allows direct interaction with an interpreter. The interpreter usually runs an entire program all at once. But the interpreter can run one line of code at a time within a Python shell.

Concepts in Practice

Using a Python shell

1.

Python is a _____ language.
  1. high-level
  2. low-level

2.

Which of the following is the most basic line of code the interpreter can run?
  1. print(1 + 1)
  2. 1 + 1
  3. 1

3.

What result does the shell display after running the line name = input()?
  1. the name that was input
  2. nothing (except for >>>)

Shortcut Key In Python

In Python, there isn’t a single “shortcut key” because Python is a programming language, not a program with menus or buttons. However, if you’re asking about shortcut keys in Python environments or editors (like VS Code, PyCharm, Jupyter Notebook, or IDLE), here are some helpful ones:

Common Shortcut Keys in Python Editors

  • In Jupyter Notebook
Action Shortcut
Run cell Shift + Enter
Run cell and insert below Alt + Enter
Insert cell above A (in command mode)
Insert cell below B (in command mode)
Delete cell D D (press D twice)
Change to code cell Y
Change to markdown cell M
Save notebook Ctrl + S

  •   In VS Code (Python Extension)
Action Shortcut
Run Python file Ctrl + F5
Run selected code Shift + Enter (with Jupyter extension)
Open integrated terminal `Ctrl + “
Format code Shift + Alt + F
Go to definition F12
Auto-complete Ctrl + Space

  •   In PyCharm
Action Shortcut
Run Shift + F10
Debug Shift + F9
Auto-complete Ctrl + Space
Show intention actions Alt + Enter
Reformat code Ctrl + Alt + L

Leave a comment

Your email address will not be published. Required fields are marked *