100% de satisfacción garantizada Inmediatamente disponible después del pago Leer en línea o como PDF No estas atado a nada 4,6 TrustPilot
logo-home
Examen

INTRO TO PYTHON (OA) PRACTICE QUESTIONS WITH CORRECT ANSWERS

Puntuación
-
Vendido
-
Páginas
7
Grado
A+
Subido en
11-06-2025
Escrito en
2024/2025

INTRO TO PYTHON (OA) PRACTICE QUESTIONS WITH CORRECT ANSWERS

Institución
D335
Grado
D335

Vista previa del contenido

INTRO TO PYTHON (OA) PRACTICE
QUESTIONS WITH CORRECT ANSWERS

Create ba bsolution bthat baccepts bthree binteger binputs brepresenting bthe bnumber bof
btimes ban bemployee btravels bto ba bjob bsite. bOutput bthe btotal bdistance btraveled bto
btwo bdecimal bplaces bgiven bthe bfollowing bmiles bper bemployee bcommute bto bthe bjob
bsite. bOutput bthe btotal bdistance btraveled bto btwo bdecimal bplaces bgiven bthe bfollowing
bmiles bper bemployee bcommute bto bthe bjob bsite:


Employee bA: b15.62 bmiles
Employee bB: b41.85 bmiles
Employee bC: b32.67 bmiles
The bsolution boutput bshould bbe bin bthe bformat
Distance: btotal_miles_traveled b- bcorrect banswer✔✔commute b= b{
b'Employee bA': b15.62, b
b'Employee bB': b41.85, b
b'Employee bC': b32.67
}
travels b= b{
b'Employee bA': bint(input()), b
b'Employee bB': bint(input()), b
b'Employee bC': bint(input())
}
t_d_t b= bsum(commute[employee]*travels[employee] bfor bemployee bin btravels)
print(f'Distance: b{t_d_t:.2f} bmiles')

Create ba bPython bsolution bto bthe bfollowing btask. bEnsure bthat bthe bsolution bproduces
boutput bin bexactly bthe bsame bformat bshown bin bthe bsample(s) bbelow, bincluding
bcapitalization band bwhitespace.
Task:
Create ba bsolution bthat baccepts ban binteger binput brepresenting bany bnumber bof
bounces. bOutput bthe bconverted btotal bnumber bof btons, bpounds, band bremaining
bounces bbased bon bthe binput bounces bvalue. bThere bare b16 bounces bin ba bpound band
b2,000 bpounds bin ba bton.
The bsolution boutput bshould bbe bin bthe bformat

, Tons: bvalue_1 bPounds: bvalue_2 bOunces: bvalue_3 b- bcorrect banswer✔✔opp b= b16
top b= b2000
ounces b= bint(input())
tons b= bounces b// b(opp b* btop)
ro b= bounces b% b(opp b* btop)
pounds b= bro b// bopp
ro b%= bopp
print(f'Tons: b{tons}')
print(f'Pounds: b{pounds}')
print(f'Ounces: b{ro}')

Create ba bsolution bthat baccepts ban binteger binput brepresenting bthe bindex bvalue bfor
bany bany bof bthe bfive belements bin bthe bfollowing blist:
various_data_types b= b[516, b112.49, bTrue, b"meow", b("Western", b"Governors",
b"University"), b{"apple": b1, b"pear": b5}]


Using bthe bbuilt-in bfunction btype() band bgetting bits bname bby busing bthe b.name
battribute, boutput bdata btype b(e.g., bint", b"float", b"bool", b"str") bbased bon bthe binput
bindex bvalue bof bthe blist belement.


The bsolution boutput bshould bbe bin bthe bformat
Element bindex_value: bdata_type b- bcorrect banswer✔✔I_V b= bint(input())
if b-1 b<= bI_V b< blen(various_data_types):
belement b= bvarious_data_types b[I_V]
D_T_N b= bstr(type(element)).split("'")[1]
print(f' bElement b{I_V}: b{D_T_N}')

Create ba bsolution bthat baccepts bany bthree binteger binputs brepresenting bthe bbase
b(b1, bb2) band bheight b(h) bmeasurements bof ba btrapezoid bin bmeters. bOutput bthe
bexact barea bof bthe btrapezoid bin bsquare bmeters bas ba bfloat bvalue. bThe bexact barea
bof ba btrapezoid bcan bbe bcalculated bby bfinding bthe baverage bof bthe btwo bbase
bmeasurements, bthen bmultiplying bby bthe bheight bmeasurement.


Trapezoid bArea bFormula:A b= b[(b1 b+ bb2) b/ b2] b* bh

The bsolution boutput bshould bbe bin bthe bformat
Trapezoid barea: barea_value bsquare bmeters b- bcorrect banswer✔✔base_1 b=
bint(input())
base_2 b= bint(input())
height b= bint(input())
area b= b0.5 b* b(base_1 b+ bbase_2) b* bheight b
print(f'Trapezoid barea: b{area:.1f} bsquare bmeters')

Create ba bsolution bthat baccepts bfive binteger binputs. bOutput bthe bsum bof bthe bfive
binputs bthree btimes, bconverting bthe binputs bto bthe brequested bdata btype bprior bto
bfinding bthe bsum.

Escuela, estudio y materia

Institución
D335
Grado
D335

Información del documento

Subido en
11 de junio de 2025
Número de páginas
7
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

$13.49
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Leer en línea o como PDF
No estas atado a nada

Conoce al vendedor

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.
lectbetty Harvard University
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
23
Miembro desde
1 año
Número de seguidores
0
Documentos
2487
Última venta
2 meses hace
Betty

Welcome to Bettys store, your reliable source for high-quality test banks and study materials drawn to help you stand out academically. We offer a broad range of resources including test banks, study guides, solution manuals, and other study materials, all dilligently curated to ensure accuracy and effectiveness. Our affordable, instantly accessible materials are complemented by excellent customer support, making your learning experience seamless and efficient. Trust Betty to be your friend in academic success.

Lee mas Leer menos
4.3

4 reseñas

5
2
4
1
3
1
2
0
1
0

Documentos populares

Recientemente visto por ti

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