DEV Community

Cover image for Ultimate Guide TO Python programming
Lizaatis1
Lizaatis1

Posted on

Ultimate Guide TO Python programming

Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. It was created by Guido van Rossum during 1985- 1990

*Characteristics of Python Programming -
*

-It supports functional and structured programming methods as well as OOP.
-It can be used as a scripting language or can be compiled to byte-code for building large applications.
-It provides very high-level dynamic data types and supports dynamic type checking.
-It supports automatic garbage collection.
-It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.

_For download and installation check
Setting up Visual Studio Code

**
Setting up the VS Code, you follow these steps:**

First, navigate to the VS Code official website and download the VS code based on your platform (Windows, macOS, or Linux).

  1. launch the setup wizard and follow the steps.
  2. Once the installation completes, you can launch the VS code application:
  3. Install Python Extension

To make the VS Code works with Python, you need to install the Python extension from the Visual Studio Marketplace.

steps:

  • click the Extensions tab.

    • type the python keyword on the search input.
    • click the Python extension. It’ll show detailed information on the right pane.
  • Finally, click the Install button to install the Python extension.

Creating a new Python project

  • Create a new folder called helloworld.
  • Launch the VS code and open the helloworld folder.
  • create a new app.py file and enter the following code and save the file:
  • print('Hello, World!')

A function

When you sum two numbers, that’s a function. And when you multiply two numbers, that’s also a function.
Each function takes your inputs, applies some rules, and returns a result.
In the above example, the print() is a function. It accepts a string and shows it on the screen.
Python has many built-in functions like the print() function to use them out of the box in your program.
In addition, Python allows you to define your functions, which you’ll learn how to do it later.

*Executing the Python program on VS
*

Image description
To execute the pro.py file, you first launch the Command Prompt on OS.

, navigate to the helloworld folder.

then type the following command to execute the pro.py file:

python pro.py
Code language: Python (python)

If everything is fine, you’ll see the following message on the screen:

Hello, World!
Code language: Python (python)

If you use VS Code, you can also launch the Terminal within the VS code by:

Accessing the menu Terminal > New Terminal
Or using the keyboard shortcut Ctrl+Shift+`.
Enter fullscreen mode Exit fullscreen mode

Typically, the backtick key (`) locates under the Esc key on the keyboard.

Python IDLE

Image description

In full is Python Integration Development Environment (IDE), it comes with the Python distribution by default.
The Python IDLE is also known as an interactive interpreter. It has many features such as:

  • Code editing with syntax highlighting
  • Smart indenting
  • And auto-completion

Python IDLE helps you experiment with Python quickly in a trial-and-error manner.
Process for launching python IDE:

  • Lunch the Python IDLE program:
  • A new Python Shell window will display as follows:
  • Now, you can enter the Python code after the cursor >>> and press Enter to execute it. For example, you can type the code print('Hello, World!') and press Enter, you’ll see the message Hello, World! immediately on the screen: Python Hello World - Executing code

Summary

Use the python pro.py command from the Command Prompt on Windows or Terminal on macOS or Linux to execute the app.py file.
Use the print() function to show a message on the screen.
Use the Python IDLE to type Python code and execute it immediately.

Python basics

  1. - Fundamentals
  2. - Syntax
  3. - variables
  4. - strings
  5. - numbers
  6. - boleans
  7. - constants
  8. - comments
  9. - Type conversion

Top comments (0)