,Chapter 1 Python and Its Features
1. Introduction
Python is a powerful high-level, dynamic object-oriented programming that is implemented in C, and
relies on the extensive portable C libraries.
Python is an interpreted programming language, which means that it can be executed by the computer
without compiling. Compiling is the conversion of a programing language into machine instructions that
can then be executed by the computer.
C is a general-purpose, computer programming language, supporting structured programming.
The implementation of Python studied in the course is called CPython, or Classic Python (often just called
Python) other implementations are Jthon and IronPython.
2. Using Python
Python can be used on through the command line
The command line is used to execute one line of Python code at a time. Note that the commands
executed this way cannot be saved.
To ensure that Python can be executed from any folder on a computer, the Path variable in the
Environmental Variables must be updated with the path of the Python installation.
Or the IDLE IDE
, The IDLE enables the programmer to save Python code in a file and execute all the code at once. One can
edit, debug and preview code in the IDLE.
3. Basic Elements in a Program
Programs consist of the following basic elements, a collection of literals, variables, and keywords.
Literals
A literal is a number or string that appears directly in a program, e.g.
In Python, you can use both single and double quotes to represent strings. The strings that run over
multiple lines are represented by triple quotes.
Variables
Variables are used for storing data in a program. E.g.
l = 10
Length = 10
k= "Hello World!"
a = True # Boolean variable
b = [2, 9, 4] # List variable
c = ('apple', 'mango', 'banana') # tuple variable
A tuple in python language refers to an ordered, immutable (non-
changeable) set of values of any data type.
Keywords
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller StudyBuddyUnisa. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $2.73. You're not tied to anything after your purchase.