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
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