DFP40203 CH1 Introduction to Python
DFP40203 CH1 Introduction to Python
INTRODUCTIO
N TO PYTHON
PROGRAMMIN
G
DFP 40203 PYTHON
PROGRAMMING
SESSION I : 2024/2025
Display general description
about Python
COURSE
Display Basic Principles of
LEARNING Python
OUTCOME
Display the features of Python
2. Interpreted language
o The source code of a Python is converted into bytecode that is then
executed by the Python virtual machine. There is no explicit compilation step in
Python.
https://www.javatpoint.com/python-features
HOW TO RUN PYTHON PROGRAM ?
There are several ways in which you can run a Python program,
including
• Interactively using the Python interpreter
• Stored in a file and run using the Python command
• Run as a script file specifying the Python interpreter to use within the
script file
• From within a Python IDE (Integrated Development
Environment) such as PyCharm.
INTERACTIVELY USING THE PYTHON INTERPRETER
• This method uses the Python REPL (Read Evaluate Print Loop style of
operation).
• Using the REPL, Python statements and expressions can be typed
into the Python prompt and will then be executed directly.
• The values of variables will be remembered and may be used later in
the session.
• To run the Python REPL, Python must have been installed onto the
computer system you are using.
• Once installed you can open a Command Prompt window
(Windows) or a Terminal window (Mac) and type python into the
prompt.
INTERACTIVELY USING THE PYTHON INTERPRETER
#!/usr/local/bin/python3
print('Hello, world')
print(5 + 4)
name = 'John'
print(name)
EXECUTING A PYTHON SCRIPT
1. An example of the hello.py script for a Windows or Linux machine is
given below using Notepad++ on a Windows box.
USING PYTHON IN AN IDE
1. We can also use an IDE such as PyCharm to writing and execute our
Python program. The same program is shown using PyCharm below: