• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 4 out of 69 pages
Exam (elaborations)

CSC401 - Introduction to Programming, Ch2 - CSC401, CSC 401 Test 2, python, Python Programming Review, Introduction to Computer Programming: Python, Python Programming Test, Introduction to Python 3 Programming, Introduction to Programming in Python st

Document preview thumbnail
Preview 4 out of 69 pages

CSC401 - Introduction to Programming, Ch2 - CSC401, CSC 401 Test 2, python, Python Programming Review, Introduction to Computer Programming: Python, Python Programming Test, Introduction to Python 3 Programming, Introduction to Programming in Python study guide with Q&As

Content preview

CSC401 - Introduction to Programming, Ch2 - CSC401, CSC 401 Test 2,
python, Python Programming Review, Introduction to Computer
Programming: Python, Python Programming Test, Introduction to Python 3
Programming, Introduction to Programming in Python study guide with
Q&As


Data Type

String, Int, Float, Boolean

Class

Same as data type

How do you iterate through a list?

For Loop!
scores = [1,2,3,4]
for s in scores:
print(s)

Write a function named powers() that takes a positive integer n as input and prints, on the
screen, all the powers of 2 from 2^1 to 2^n.

def powers(n):
for i in range(1,n+1):
print(2**i)

How do you identify the length of a list?

len(list)

How do you iterate through a list by index instead of value?

range(len(list))

Iterate through list "pets" through the indexes

for i in range(len(pets)): #i is assigned 0, 1, 2...
print(pets[p]) #print object at index i

Why would you use range(len(list))?

,When you want to iterate through a list by index instead of value.

ie: list of strings
ie: when comparing values in a list.
-index i is followed by i+1

Python Data Types

- Integer
- Floating point
- Boolean
- String
- List

Algebraic Operators

+, -, , /, //, %, *

Algebraic Funtions

- abs()
- min()
- max()

Assignment Statement

x=4

Algebraic Expression

-3+7
-2*3+1
- 14//3
- 2**4

Boolean Expression

2<3
True

Comparison Operators

>, <, ==, >=, <=, !=

Boolean Operators

,- and
- or
- not

String Operators

- in
- not in
- s n, n s
-s+t
- s[i]

List Operators

- x in lst
- x not in lst
- lstA + lstB
- lst n, n lst
- lst[i]

List Functions

- len(lst)
- min(lst)
- max(lst)
- sum(lst)

List Methods

- lst.append(item)
- lst.count(item)
- lst.index(item)
- lst.insert(index, item)
- lst.pop()
- lst.remove(item)
- lst.reverse()
- lst.sort()

Constructors

- int()
- float()

, - str()
- list()

Implicit Type Conversion

>>> 3 + 0.35
3.35

Explicit Type Conversion

Attributes of a Variable

Name
Address
Type
Value
Scope
Lifetime

Language design binding

bounding a symbol to an operation

Language Implementation binding

type sizes vary from machine to machine but are bounded when the compiler is installed

Compile time binding

A variable is bound to a type when a program is compiled

Load time binding

When a program is loaded the addresses are bound to the variables

Link time binding

When a program links to a library the names of the variables and subprograms in the library are
bound

Static Type binding

Variable types does not change after the program compiles

Dynamic Type binding

Variable types are bounded during the runtime or can change during the runtime

Document information

Uploaded on
March 18, 2026
Number of pages
69
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$13.99

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.
MREXAMS
2.5
(4)
Sold
27
Followers
1
Items
977
Last sold
3 weeks ago



Why students choose Stuvia

Created by fellow students, verified by reviews

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

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card 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