100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

DEAF 310 Homework 3.1 to 3.6 Solution

Rating
-
Sold
-
Pages
10
Grade
A+
Uploaded on
09-06-2025
Written in
2024/2025

DEAF 310 Homework 3.1 to 3.6 Solution

Institution
DEAF 310 Homework 3.1 To 3.6
Course
DEAF 310 Homework 3.1 to 3.6









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
DEAF 310 Homework 3.1 to 3.6
Course
DEAF 310 Homework 3.1 to 3.6

Document information

Uploaded on
June 9, 2025
Number of pages
10
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

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.
$16.99
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
orwaruwilliam5

Also available in package deal

Thumbnail
Package deal
Exam revisions
-
91 2025
$ 1,673.99 More info

Get to know the seller

Seller avatar
orwaruwilliam5 Chamberlain College Of Nursing
View profile
Follow You need to be logged in order to follow users or courses
Sold
1
Member since
6 months
Number of followers
0
Documents
130
Last sold
5 months ago

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions