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

Python Questions With All Correct & Verified Answers

Document preview thumbnail
Preview 3 out of 16 pages

Python Questions With All Correct & Verified Answers

Content preview

Python Questions With All Correct &
Verified Answers
1. Create a solution that accepts three integer inputs A = int(input()) *
15.62
representing the number of times an employee travels B = int(input(
* 41.85
to a job site. Output the total distance traveled to two C = int(input()
* 32.67
decimal places given the following miles per employee
commute to the job site. Output the total distance trav- total = A + B
+C
eled to two decimal places given the following
miles per employee commute to the job print(f"Distance: {to-
site: tal:.2f} miles")
Employee A: 15.62
miles Employee B:
41.85 miles Employee
C: 32.67 miles
The solution output should be in the
format Distance: total_miles_traveled total_oz = int(input())

2. Create a solution that accepts an integer input tons = total_oz // 32000
repre- senting any number of ounces. Output the
converted total number of tons, pounds, and
remaining ounces
based on the input ounces value. There are 16 ounces pounds =
(total_oz %
in a pound and 2,000 pounds in a ton.
3. Create a
The solution output should be in the solution that
format Tons: value_1 accepts an
integer input
Pounds: value_2
repre-
Ounces: value_3


1/
16

, Python Questions With All Correct &
Verified Answers
32000) // 16 {pounds}")
ounces = total_oz % 16 print(f"Ounces:
{ounces}")
print(f"Tons: {tons}") print(f"Pounds:
various_data_types =
senting the index value for any any of the five elements [516, 112.49
True,
in the following list: "meow", ("Western",
"Governors", "University"
various_data_types = [516, 112.49, True, {"apple": 1, "pear": 5}]
"meow", ("Western", "Governors",
"University"), {"apple": 1,




2/
16

, Python Questions With All Correct &
Verified Answers
"pear": 5}] value =
int(input()) z =
Using the built-in function type() and getting
vari-
its name by using the .name attribute,
ous_data_types[valu
output data type (e.g., int", "float", "bool",
e] data_type =
"str") based on the input index value of the
type(z). name
list element.
print(f"Element
{value}:
The solution output should be in the format
{data_type}")
Element index_value: data_type

4. Create a solution that accepts any three integer inputs b1
= int(input())
representing the base (b1, b2) and height (h) measure- b2 =
int(input())
ments of a trapezoid in meters. Output the h = int(input())
exact area of the trapezoid in square meters as
a float value. The exact area of a trapezoid can a = ((b1 + b2) / 2) * h
be calculated by finding
average of the two base measurements, then mul-
the {a}
area: print(f"Trapezoid
tiplying by the height measurement.
square meters")
Trapezoid Area Formula:A = [(b1 + b2) /

2] * h The solution output should be in

the format

Trapezoid area: area_value square
meters

5. Create a solution that accepts five integer inputs. Out- n1 =
int(input())
3/
16

Document information

Uploaded on
April 26, 2025
Number of pages
16
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$14.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.
Studyclub
3.6
(14)
Sold
71
Followers
1
Items
13658
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