100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4.2 TrustPilot
logo-home
Tentamen (uitwerkingen)

DEAF 310 Homework 3.1 to 3.6 Solution

Beoordeling
-
Verkocht
-
Pagina's
10
Cijfer
A+
Geüpload op
09-06-2025
Geschreven in
2024/2025

DEAF 310 Homework 3.1 to 3.6 Solution

Instelling
DEAF 310 Homework 3.1 To 3.6
Vak
DEAF 310 Homework 3.1 to 3.6









Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Geschreven voor

Instelling
DEAF 310 Homework 3.1 to 3.6
Vak
DEAF 310 Homework 3.1 to 3.6

Documentinformatie

Geüpload op
9 juni 2025
Aantal pagina's
10
Geschreven in
2024/2025
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

Voorbeeld van de inhoud

DEAF 310 Homework 3.1 to 3.6 Solution

Write the definition of a function named sum_list that has one parameter, a
list whose elements are of type int. The function returns the sum of the
elements of the list as an int. --correct answers-- "Write the definition of
a function named sum_list that has one parameter, a list whose elements
are of type int"- will be using "def", and it will have one parameter- x, which
is a list- def sum_list(x):
"The function returns the sum of the elements of the list as an int."- This
means the return value will be the sum of everything in the list. The easiest
way to do this will be using the sum() function
code:
def sum_list(x):
return sum(x)

how to write booleans in python --correct answers-- "True" and "False"-
make sure to capitalize!!!!

how to write does not equal sign --correct answers-- !=

"Write an expression that evaluates to True if and only if is_a_member is
False." --correct answers-- *no equals sign*, but can use the ==
because this just means that something equals a certain value, won't
assign it a value
so the code is:
is_a_member == False




Assume that isIsosceles is a boolean variable , and that the variables
isoCount,triangleCount, and polygonCount have all been initialized. Write a
statement that adds 1 to each of these count variables
(isoCount,triangleCount, and polygonCount)if isIsosceles is true." --correct
answers-- if isIsosceles == True:
isoCount +=1
triangleCount += 1

, polygonCount +=1

"Clunker Motors Inc. is recalling all vehicles from model years 1995-1998
and 2004-2006. Given a variable modelYear write a statement that prints
the message "RECALL" to standard output if the value of modelYear falls
within those two ranges." --correct answers-- if
((1995<=modelYear<=1998) or (2004<=modelYear<=2006)):
print("RECALL")

Given a String variable named sentence that has been initialized, write an
expression whose value is the index of the very last character in the String
referred to by sentence --correct answers-- how to work through this:
"Given a String variable named sentence that has been initialized" - will be
using a variable called "sentence" that is a string
"write an expression" - no equals sign
"the index of the very last character in the String referred to by sentence" -
means that they want the numerical value (place) of the last character
this can be done by finding the length of the entire string, because the
length of the entire string = numerical place of the last character
code = len(sentence[:-1])

does [-1] include the last digit --correct answers-- yes

what does "index" mean --correct answers-- the numerical place of a
letter/number in a string, as you would write it using the indexing operator
ex. index of the letter "r" in "Blair" is 4, because you would do Blair[4] to find
"r"

Write an expression whose value is the character at index 3 of the str
associated with s. --correct answers-- s[3]

Given a variable word that has been assigned a string value, write a string
expression that parenthesizes the value of word. So, if word contains
"sadly", the value of the expression would be the string "(sadly)" --correct
answers-- how to work through this:
the variable "word" contains a string expression in it, and we want to add
quotes and a parenthesis around it. You would think that you would just
add the parenthesis and quotes by using the ""- but no.
€14,93
Krijg toegang tot het volledige document:

100% tevredenheidsgarantie
Direct beschikbaar na je betaling
Lees online óf als PDF
Geen vaste maandelijkse kosten

Maak kennis met de verkoper
Seller avatar
orwaruwilliam5

Ook beschikbaar in voordeelbundel

Maak kennis met de verkoper

Seller avatar
orwaruwilliam5 Chamberlain College Of Nursing
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
1
Lid sinds
6 maanden
Aantal volgers
0
Documenten
130
Laatst verkocht
5 maanden geleden

0,0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Veelgestelde vragen