• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 3 fuera de 16 páginas
Examen

Python Questions With All Correct & Verified Answers

Document preview thumbnail
Vista previa 3 fuera de 16 páginas

Python Questions With All Correct & Verified Answers

Vista previa del contenido

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

Información del documento

Subido en
26 de abril de 2025
Número de páginas
16
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas
$14.49

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
Studyclub
3.6
(14)
Vendido
71
Seguidores
1
Artículos
13658
Última venta
1 semana hace



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes