Garantie de satisfaction à 100% Disponible immédiatement après paiement En ligne et en PDF Tu n'es attaché à rien 4,6 TrustPilot
logo-home
Examen

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

Note
-
Vendu
-
Pages
19
Grade
A+
Publié le
17-10-2024
Écrit en
2024/2025

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

Établissement
Python
Cours
Python

Aperçu du contenu

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

École, étude et sujet

Établissement
Python
Cours
Python

Infos sur le Document

Publié le
17 octobre 2024
Nombre de pages
19
Écrit en
2024/2025
Type
Examen
Contient
Questions et réponses

Sujets

€16,98
Accéder à l'intégralité du document:

Garantie de satisfaction à 100%
Disponible immédiatement après paiement
En ligne et en PDF
Tu n'es attaché à rien


Document également disponible en groupe

Faites connaissance avec le vendeur

Seller avatar
Les scores de réputation sont basés sur le nombre de documents qu'un vendeur a vendus contre paiement ainsi que sur les avis qu'il a reçu pour ces documents. Il y a trois niveaux: Bronze, Argent et Or. Plus la réputation est bonne, plus vous pouvez faire confiance sur la qualité du travail des vendeurs.
StuviaExamHub Havard School
S'abonner Vous devez être connecté afin de suivre les étudiants ou les cours
Vendu
466
Membre depuis
4 année
Nombre de followers
355
Documents
17806
Dernière vente
4 jours de cela
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

88 revues

5
41
4
10
3
17
2
7
1
13

Documents populaires

Récemment consulté par vous

Pourquoi les étudiants choisissent Stuvia

Créé par d'autres étudiants, vérifié par les avis

Une qualité sur laquelle compter : rédigé par des étudiants qui ont réussi et évalué par d'autres qui ont utilisé ce document.

Le document ne convient pas ? Choisis un autre document

Aucun souci ! Tu peux sélectionner directement un autre document qui correspond mieux à ce que tu cherches.

Paye comme tu veux, apprends aussitôt

Aucun abonnement, aucun engagement. Paye selon tes habitudes par carte de crédit et télécharge ton document PDF instantanément.

Student with book image

“Acheté, téléchargé et réussi. C'est aussi simple que ça.”

Alisha Student

Foire aux questions