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

PYTHON exam with 100% correct answers 2024

Document preview thumbnail
Preview 2 out of 9 pages

The following code represents a ________________ if structure. if a = 1: if a == 1: correct answers nested Which line of code sets the value of the variable take_home to 500? take_home == 1500 / (1 + 2) take_home = 250 * 6 / 1 + 2 take_home = 250 * (5 % 3) take_home = 250 * 5 - 3 correct answers take_home = 250 * (5 % 3) Given the code message = "Your percentage score of " percentage = "95.6" letter_grade = "% is an A grade." What is the correct code to display the following result? Your percentage score of 95.6% is an A grade. correct answers print(message + percentage + letter_grade) Given the following parallel lists, which piece of code will print out each student and their major? students = ["Jimmy", "Ravi", "Lauren"] majors = ["Accounting", "Finance", "ISA"] correct answers for i,student in enumerate(students): print(student + ", Major: " + majors[i]) What will be displayed by the following code? age = 18 score = 550 income = 60000 if age = 20 or (score 600 and income 50000): print("approved") elif age 18 and age 20: print("approved with condition") else: print("not approved") correct answers not approved The while keyword takes a condition just like which other keyword? correct answers if Which of the following is a valid variable name in Python?:

Content preview

PYTHON exam
The following code represents a ________________ if structure.

if a >= 1:
if a == 1: correct answers nested

Which line of code sets the value of the variable take_home to 500?
take_home == 1500 / (1 + 2)
take_home = 250 * + 2
take_home = 250 * (5 % 3)
take_home = 250 * 5 - 3 correct answers take_home = 250 * (5 % 3)

Given the code
message = "Your percentage score of "
percentage = "95.6"
letter_grade = "% is an A grade."

What is the correct code to display the following result?
Your percentage score of 95.6% is an A grade. correct answers print(message +
percentage + letter_grade)

Given the following parallel lists, which piece of code will print out each student and
their major?

students = ["Jimmy", "Ravi", "Lauren"]
majors = ["Accounting", "Finance", "ISA"] correct answers for i,student in
enumerate(students):
print(student + ", Major: " + majors[i])

What will be displayed by the following code?
age = 18
score = 550
income = 60000
if age >= 20 or (score > 600 and income > 50000):
print("approved")
elif age > 18 and age < 20:
print("approved with condition")
else:
print("not approved") correct answers not approved

The while keyword takes a condition just like which other keyword? correct answers if

Which of the following is a valid variable name in Python?:

, 1st place
None of these answers
1st_place
and correct answers None of these answers

What is printed by the following program?

my_total = 0
do_not_stop = True
while do_not_stop == True:
my_total += 5
if my_total > 10:
do_not_stop = False
print(my_total) correct answers 15

A _____________ is Boolean variable often used to control the operation of loops.
correct answers flag

What code should be added to the end of the following code to display a single
message if the city is not found in the list?

city_input = input("Input a city")
possible_cities = ["Detroit", "Cincinnati", "Atlanta"]
city_is_there = False
for city in possible_cities:
if city_input == city:
print("The city is there!")
city_is_there = True
break correct answers This code at the same level of indention as the for in the
question above.
if city_is_there == False:
print("The city is not there")

How many lines of output will be printed by the following code?

sum = 0
for i in range(1,3):
for j in range(1,4):
sum += i * j
print(sum) correct answers 6

The index of the first element in a Python list is ____________. correct answers 0

The following program is intended to display True Love. The program contains an error.
Which answer best describes the problem with the program?

Document information

Uploaded on
August 3, 2024
Number of pages
9
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$12.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.
HopeJewels
3.6
(8)
Sold
102
Followers
11
Items
8866
Last sold
1 week 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