FIT 1008/2085 A1 quiz

FIT 1008/2085 A1 quiz (please don’t try the quiz yet)

/4

FIT 1008/2085 Quiz

FIT 1008/2085 Quiz

1 / 4

What will be the returned value from the following function:

def mystery(lst):    bingo = 0    for item in lst:        if bool(item):            bingo += 1    return bingo

when the value of list is [0, 1, 2, 3, None, 5, -0, 6, 7, None]

2 / 4

Consider the following implementation of a class for a Monash student:

class Student:    def __init__(self, name, stud_id):        self.name = name        self.stud_id = stud_id        def __gt__(self, other):        # TODO: Finish implementation

3 / 4

What is the purpose of this function?

def scramble(my_container):    mid = len(my_container)//2    a = my_container[mid]    b = my_container[0]    c = []    for item in my_container:        if item > a:            c.append(item)        elif item < b:            b = item     return c, b

4 / 4

How many times will the marked line in the following code run when the input integer is n?

def mystery(n):     stamp = 0     if n <= 0:         return 0     else:         for i in range(n):             for j in range(n):                stamp += j # This line return stamp

Answer in terms of n

Your score is

0%

No Comments

Send Comment Edit Comment


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
Previous
Next