0% found this document useful (0 votes)
12 views2 pages

PASS Midterm Review

The document reviews topics covered in weeks 3 through 6 of an introductory Python course, including branching logic, data types like lists, strings and dictionaries, repetition structures like for and while loops, and functions. Students are asked questions to test their understanding of keywords, syntax, and applications of these core Python concepts for tasks like checking string lengths, looping through ranges, and calculating sums or differences of user-input numbers.

Uploaded by

yqcgwvn6wp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

PASS Midterm Review

The document reviews topics covered in weeks 3 through 6 of an introductory Python course, including branching logic, data types like lists, strings and dictionaries, repetition structures like for and while loops, and functions. Students are asked questions to test their understanding of keywords, syntax, and applications of these core Python concepts for tasks like checking string lengths, looping through ranges, and calculating sums or differences of user-input numbers.

Uploaded by

yqcgwvn6wp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

ENDG 233 - PASS Worksheet

Midterm Review

Week 3: Branching Logic


1. What are the branching logic keywords and how would declare them in python?

2. Create a program that takes a string input from the user and and checks if the length
of the string is divisible by 4. If true the program outputs “The string is divisible by
4!”, otherwise print the string is not divisible by 4.

Week 4: Compound Data Types


3. Match the Python data types with its description by placing the letter of the definition
in the space preceding the data type’s name.

1. _____ Lists A. Immutable data type that stores an


ordered sequence of items. Defined within
parentheses () where items are separated
by commas.
2. _____ String
B. Unordered collection of unordered
items. Defined within curly brackets {}
where items are separated by commas
3. _____ Set C. Mutable data type that stores an ordered
sequence of items. Declared with square
brackets [] where items are separated by
commas.
4. _____ Dictionary
D. A sequence of characters. Surrounded
by single quotes, double quotes, or triple
quotes
5. _____ Tuple E. Mutable, data type that stores a
collection of key: value pairs.
Week 5: Repetition Structures
4. Fill in the blank.
There are two types of loops in Python, __________ loop and a __________ loop.
_________ loops are typically used when the number of iteration is known, whereas
_________ loops are typically used when the number of iteration are unknown and it
continues to execute the block of code based on the ____________ condition.
The following two snippets of code produce the ___________ output.

i = 0
______ i < 10:
print(i)
i += 1

_____ i in _______(10):
print(i)

Week 6: Functions
5. List 3 advantages of using functions
a.
b.
c.

6. Write two python functions to find the sum or difference of a list of numbers the user
inputs. The user can input as many numbers as they want. They will choose whether
they want to find the sum or difference. If they choose difference the equation will be
num1 - num2 - num3 - .....

You might also like