• 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 1 out of 4 pages
Exam (elaborations)

Cs101 Python Test 2025

Document preview thumbnail
Preview 1 out of 4 pages

CS101 PYTHON TEST 2025....

Content preview

While loops - ANSWER -executes a series of steps while some condition is
true
-the test (part between the parentheses) returns either true or false
-loop continues until the test returns false
-while loops are used when we don't know how many times we need to repeat
the steps... it relies on an external condition
Ex: while (there are still lines in a file)
read the next line
print the line out

For Loops - ANSWER - executes a series steps of steps a finite amount of
times-text evaluates a counter, when it reaches the last value, the loop stops
repeating-we use a for loop when we know ahead of time how many times, we
need to repeat the stepsEx: for (count = 1 to 12)do a stepdo another stepincrease
the count by one

print() - ANSWER a built-in function to display on screen in Python

String - ANSWER set of characters represented in quotation marks

int(x) - ANSWER to convert x to a plain integer

float(x) - ANSWER to convert x to a floating-point number.

Variables - ANSWER are assigned values using the '=' operator, which is not
to be confused with the '==' sign used for testing equality. A variable can hold
almost any type of value such as lists, dictionaries, functions.
Ex: >> x = 12 12

Functions - ANSWER Python builds ___ using the syntax:
def function_name(variable): Functions can be stand-alone or can return values.
Functions can also contain other functions.
Ex: def add_two(a, b): c=a+b

Document information

Uploaded on
January 4, 2025
Number of pages
4
Written in
2024/2025
Type
Exam (elaborations)
Contains
Unknown
$11.49

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.
Boostertips
3.8
(44)
Sold
267
Followers
195
Items
5174
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