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

Python Exam 1 questions with answers graded A+(19)

Puntuación
-
Vendido
-
Páginas
19
Grado
A+
Subido en
17-10-2024
Escrito en
2024/2025

Python Exam 1 questions with answers graded A+(19)

Institución
Python
Grado
Python










Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Institución
Python
Grado
Python

Información del documento

Subido en
17 de octubre de 2024
Número de páginas
19
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

Vista previa del contenido

Python Exam 1 questions with answers
graded A+(19)

Finish the following code example with the print statement that will return a value of True.

a=5

b = 5.5

c=7

d = 7.5

print( Choose One...

print(a == int(b) and c != int(d))

print(a != int(b) and c != int(d))

print(a != int(b) and c == int(d))

print (a == int(b) and c == int(d)) ) - correct answer ✔✔print(a == int(b) and c == int(d))



print(5 == int(5.5) and 7 == int(7.5))



The following code example needs to print, for five weeks, the # of minutes per day to walk, starting with
10 minutes a day in week 1 and ending 50 minutes a day in week 5 choose the correct line of code to
start this iteration and finish this code example.

Choose One...

a) for week in range(1,5)

b) for week in range(5)

c) for week in range(1,6)

d) while week < 5

print("You should walk for ", week * 10, " minutes in ", week) - correct answer ✔✔for week in range(1,6)



Look at the following code and then indicate, for each question, a yes or no based on whether the
statement is true or false.

,a=5

b=3

b=a



a == b yes or no

a is b yes or no

b == 3 yes or no - correct answer ✔✔a == b yes

a is b yes

b == 3 no



Open the shirts file in a mode to where it cannot be written to

Read the contents of the entire file

Print the contents of the entire file

Not every line of code is used:

shirtFile = open("shirts.txt","a)

shirtFileContents = shirtFile.read()

for shirtLines = range(shirtFile):

print(shirtFileContents)

shirtFile = open("shirts.txt","r") - correct answer ✔✔LINE 1: shirtFile = open("shirts.txt", "r")

LINE 2:

shirtFileContents = shirtFile.read()



LINE 3: print(shirtFileContents)



How many syntax errors are there in the following code?

if totalSales>= 700000:

print("Gold Customer")

elif totalSales >= 400000:

print("Silver Customer")

, elif totalSales >= 100000 and newCustomer:

print("Bronze Customer and first-time prize winner")

elif totalSales >= 100000

print("Bronze Customer")

prnit("Thank you for your business") - correct answer ✔✔3



The goal with this is to show the nearest integer above and below the # (above for the upperBound
variable and below for the lowerBound variable) given and have it work when a different number is
present.

Choose One...

import math

use math

sys.math

sampleNumber = 77.4

upperBound = Choose One...

math.ceil

math.ceiling

math.round

math.floor (sampleNumber)

lowerBound = Choose One...

math.ceil

math.ceiling

math.round

math.floor (sampleNumber)

print(upperBound)

print(lowerBound) - correct answer ✔✔As the math built-in module is being used, the module needs to
be imported. That is done on the first line of code. The math.ceil function takes a floating number up to
the next whole number. The math.floor function lowers a floating number to its base whole number. A
round function would not be efficient here as it would not guarantee the upper and lower integers from
the floating number and returned

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.
StuviaExamHub Havard School
Ver perfil
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
458
Miembro desde
3 año
Número de seguidores
355
Documentos
16965
Última venta
4 días hace
EXAM HUB (LATEST UPDATE)

QUALITY WORK OF ALL KIND OF QUIZ or EXAM WITH GUARANTEE OF AN A+ latest updates Im an expert on major courses especially; psychology,Nursing, Human resource Management &amp; Project writing. Assisting students with quality work is my first priority. I ensure scholarly standards in my documents . I assure a GOOD GRADE if you will use my work. Feel free to purchase n recommend others for 100% pass EXAMS!

3.7

85 reseñas

5
39
4
10
3
17
2
6
1
13

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