CS101 Quiz 1

0.0(0)
Studied by 1 person
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/14

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 11:53 PM on 2/16/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

15 Terms

1
New cards

Type of variable returned by the define function [8]

List

2
New cards

Slicing and Modifying a String

result = text[8:].upper() + text[0]

result = (text[2:] + text[0]).replace('d', 'rat')

result = text[0:12].upper() + text[-1]

result = text[8:].lower() + text[0]

result = elements[0:5] + [elements[-1]]

result = elements[2:]

result.append(elements[0])

result.pop(2)

3
New cards

Arbitrary Math Formulas

n = len(xx)

result = float(sum((x**(n - 2)) / (x ** 2) for x in xx))

4
New cards

Group as Maximum

yy = [max(xx[i:i+5]) for i in range(0, len(xx), 5)]

5
New cards

Return a List of Parameters that Fit the Specified Conditions

def list_make(a, b, c):

return [x for x in (a, b, c) if x < -2]

def list_make(a, b, c):

return [num for num in (a, b, c) if 0 < num < 5]

6
New cards

Add the Multi-Dimensional Coordinates after Squaring

result = sum(int(x)**2 for x in coords.split(','))

7
New cards

Slicing and Modifying a List

result = elements[2:] + [elements[0]]

result.insert(2, 56)

8
New cards

Temperature Checks

def temp_check(temp):

if temp > 79:

return "Impossibly hot"

elif temp < 49:

return "Too cold!"

elif (79 - temp) < 5 or (temp - 49) < 5:

return "Somewhat questionable"

else:

return "Great!"

9
New cards

Add sqrt of multi dimensional coords

result = sum(math.sqrt(int(num)) for num in coords.split(','))

10
New cards

Joining Strings

yy = [";".join(xx[i:i+5]) for i in range(0, len(xx), 5)]

11
New cards

Group as Averages

yy = [sum(xx[i:i+4]) / 4 for i in range(0, len(xx), 4)]

12
New cards

FizzBuzz

def fizzbuzz_family(num):

if num % 3 = 0 and num % 5 = 0:

return "FizzBuzz"

elif num % 3 == 0:

return "Fizz"

elif num % 5 == 0:

return "Buzz"

else:

return num

13
New cards

Multiply multi dimensional coords

result = 1.0

for num in coords.split('/'):

result *= (int(num) / 2)

14
New cards

Average the cubed multi-dimensional coords

nums = coords.split(';')

result = sum(float(num) ** 3 for num in nums) / len(nums)

15
New cards

Group as Minimum

yy = [min(xx[i:i+4]) for i in range(0, len(xx), 4)]