• ¿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 2 fuera de 7 páginas
Examen

Intro To Python (Oa) Practice Questions With Correct Answers

Document preview thumbnail
Vista previa 2 fuera de 7 páginas

INTRO TO PYTHON (OA) PRACTICE QUESTIONS WITH CORRECT ANSWERS

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.

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
$13.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.
lectbetty
4.3
(4)
Vendido
25
Seguidores
0
Artículos
2462
Última venta
5 meses 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