logo

Crowdly

Programming Fundamentals-Lecture,Section-1-Fall 2024

Шукаєте відповіді та рішення тестів для Programming Fundamentals-Lecture,Section-1-Fall 2024? Перегляньте нашу велику колекцію перевірених відповідей для Programming Fundamentals-Lecture,Section-1-Fall 2024 в moodle.nu.edu.kz.

Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!

Given the following function definition, choose function calls that are valid and will not raise an error.

def multiply_all(*args):

result = 1

for num in args:

result *= num

return result

Переглянути це питання

Given the following program, what will be printed if the user enters 6 and 0?

while True:

try:

a = int(input("Enter a number: "))

b = int(input("Enter a number: "))

c = a/b

except ZeroDivisionError:

print("b cannot be 0")

except ValueError:

print("Enter a number")

else:

print("result is ", c)

finally:

print("testing...")

Переглянути це питання

What is printed when the following code is executed?

counter = 0

def update_counter():

global counter

counter += 1

def reset_counter():

global counter

counter = 0

update_counter()

update_counter()

reset_counter()

update_counter()

print(counter)

Переглянути це питання

Suppose you have a custom Python module called custom_math.py with the following functions, then choose all correct imports and uses of functions from this module.

# custom_math.py

def add(a, b):

return a + b

def subtract(a, b):

return a - b

def multiply(a, b):

return a * b

def divide(a, b):

if b == 0:

return "Division by zero error"

return a / b

Переглянути це питання

Given the following program, what will be printed if the user enters 6 and 6?

while True:

try:

a = int(input("Enter a number: "))

b = int(input("Enter a number: "))

c = a/b

except ZeroDivisionError:

print("b cannot be 0")

except ValueError:

print("Enter a number")

else:

print("result is ", c)

finally:

print("testing...")

Переглянути це питання

Consider the following Python function definition:

def calculate_price(amount, tax=0.05, discount=0.10):

return amount + (amount * tax) - (amount * discount)

Which of the following function calls will produce the same result as calculate_price(100, 0.1)?

0%
Переглянути це питання

Given the global variable counter and followed by function calls with their expected behavior, choose all correct definitions of update_value() and reset_counter() functions

counter = 0

update_counter(5) # counter becomes 5

update_counter(3) # counter becomes 8

reset_counter() # counter becomes 0

update_counter(2) # counter becomes 2

print(counter) # Output: 2

Переглянути це питання

Given the function definition below, choose function calls that are valid and will not raise an error.

def display_info(**kwargs):

for key, value in kwargs.items():

print(f"{key}: {value}")

Переглянути це питання

print(s4)

Переглянути це питання

print(s1+s2)

Переглянути це питання

Хочете миттєвий доступ до всіх перевірених відповідей на moodle.nu.edu.kz?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!