Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4,6 TrustPilot
logo-home
Document preview thumbnail
Preview 3 out of 23 pages
Exam (elaborations)

INF

Document preview thumbnail
Preview 3 out of 23 pages

INF1511 EXAM PREP NOTES AND 2017 EXAM PAPER WITH ANSWERS

Content preview

INF1511
EXAM PREP NOTES

,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.

10 # Integer literal
10.50 # Floating-point literal
'Hello' # String literal
"World!" # String literal
'''Hello World!
It might rain today # Triple-quoted string literal
Tomorrow is Sunday'''

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

Document information

Uploaded on
January 24, 2021
Number of pages
23
Written in
2021/2022
Type
Exam (elaborations)
Contains
Questions & answers
R50,00

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
StudyBuddyUnisa
4,8
(114)
Sold
304
Followers
177
Items
64
Last sold
1 year ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions