GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

Author Archives: Anonymous

What is ONE thing that you learned in this course about huma…

What is ONE thing that you learned in this course about human development that you found particularly important – to you personally or in the bigger picture?  There are no right or wrong answers.

Read Details

engr213_quiz2_summer2025.pdf

engr213_quiz2_summer2025.pdf

Read Details

Explain what a peremptory challenge is and how they can be u…

Explain what a peremptory challenge is and how they can be used to exclude minority groups from juries. 

Read Details

List one of the ways that jurors are selected and how this h…

List one of the ways that jurors are selected and how this has a discriminatory effect on minority groups.

Read Details

Coding Questions You may not use any concepts (including bu…

Coding Questions You may not use any concepts (including built-in functions) which we have not covered in Modules 1 – 6. You can find all material allowed in this exam at the end of these instructions. Other restrictions apply per function.  Use of coding standards and language syntax, type annotations, code clarity, and logic of the solution are part of the grade. You do not need to include main or a docstring, but you do need to include type annotations in the function definition. You should identify tasks that address a specific part of the problem and implement them as helper functions Coding questions are graded for correct syntax, proper use of coding standards, and design, (Use the space bar, not the Tab key to provide indentation) Quiz #2 Notes Data types intfloatstrboollisttuple Type Casting type(value) returns the data type of value>>> type(5) Arithmetic Operators i + j -> The sumi – j -> The differencei * j -> The producti / j -> Divisioni ** j -> i to the power of ji // j -> the quotient when i is divided by ji % j -> the remainder when i is divided by j   Relational Operators x > y      Is x greater than y?x < y      Is x less than y?x >= y     Is x greater than or equal to y?x >> len(‘hello’)5>>> len([1, 8, 2, 8])4 y in x: Returns True if y is in sequence x; False otherwise (works on strings and lists)>>> 2 in [1, 8, 2, 8]True>>> “r” in “Penn State”False   A-Z: ASCII values = 65 -> 90a-z: ASCII values = 97 -> 122ord(char): Returns an integer with the code for char>>> ord(“A”)65chr(code): Returns the character with the given code>>> chr(65)’A’   abs(value): Returns the magnitude of the given value>>> abs(5.6)5.6>>> abs(-9)9   Slicing Syntax sequence[start : end], end is exclusive   List Operations and Methods x.append(y): Adds y at the end of list x>>> lst = [1, 8, 2, 8]>>> lst.append(‘hi’)>>> lst[1, 8, 2, 8, ‘hi’] k * x: Returns the list x repeated k times>>> 3 * [0][0, 0, 0] x + y: Returns a new list that contains all elements in both lists>>> [1,2,3] + [2,3,4][1,2,3,2,3,4] pop and del remove the element at position i.>>> lst = [1, 8, 2, 8]>>> lst.pop(1)8>>> del lst[0]>>> lst.pop()  # Removes the last element8>>> lst[2]   String Operations and Methods k * x: Returns the string x repeated k times>>> 3 * ‘hello”hellohellohello’ x + y: Returns a new string that contains all elements in both strings>>> ‘hello’ + ‘world”helloworld’ Formatted string literals>>> v1=’Sam’>>> v2= 5>>> f'{v1} has {v2} coins”Sam has 5 coins’ ”.join(sequence): Takes all items in an sequence of strings and joins them into one string:>>> ‘-‘.join([‘1’, ‘2’, ‘3’])’1-2-3′ split(separator): breaks down a string into a list of substrings using a chosen separator>>> s = “hello,here,there”>>> s.split(“,”)[‘hello’, ‘here’, ‘there’]>>> s = “hello here there”>>> s.split()[‘hello’, ‘here’, ‘there’] strip(): removes any leading, and trailing whitespaces.>>> s = ”   hello    there    “>>> s.strip()’hello    there’

Read Details

Based on the following code: def my_func(txt: str) -> None: …

Based on the following code: def my_func(txt: str) -> None:    txt += ”  131″ >>> text = “CMPSC”>>> my_func(text)>>> print(text)CMPSC Why does text remain unchanged after calling my_func? 

Read Details

Rewrite the following function to use a while loop instead o…

Rewrite the following function to use a while loop instead of a for loop using the minimum number of changes. def my_func():     for i in range(5, -5, -1):         print(i)

Read Details

What does it mean for a type to be immutable in terms of mem…

What does it mean for a type to be immutable in terms of memory or object identity (memory address)? You might type a small code example to support/explain your answer.

Read Details

True or False: Recessive disorders are much more common than…

True or False: Recessive disorders are much more common than dominant disorders.

Read Details

Which of the following nitrogenous bases is only present in…

Which of the following nitrogenous bases is only present in RNA?

Read Details

Posts pagination

Newer posts 1 … 32,256 32,257 32,258 32,259 32,260 … 89,106 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top