logo

Crowdly

Basics in Computer Programming

Шукаєте відповіді та рішення тестів для Basics in Computer Programming? Перегляньте нашу велику колекцію перевірених відповідей для Basics in Computer Programming в moodle.modul.ac.at.

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

How

would you define your own error type in Python as a child of the NameError type?

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

Consider

the code below. Which error will be thrown? 

y = 12

print(“How

many eggs in a dozen?” + y)

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

What

is the output of the below code?

list = [‘apples’,

‘bananas’, ‘pears’]

string = “;”.join(list)

print(string)

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

Which

is the correct way to write to a CSV file including headers for our data? (We

have done ‘import csv’, our file object is called ‘f’ and our headers are

stored in a variable called ‘headers’)

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

Consider the

code below. What will be printed out? 

try:

   i=4

   j=[2,4,6,8]

   print(j[i])

except

IndexError:

   print(“Oops! Error.”)

else:

   print(“All OK.”)

finally:

   print(“Bye bye.”)

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

Consider

the code below. What will be printed out?

 

X = “giraffe”

Y = [“iterative”,

“recursively”, “functional”]

if len(X)<6:

   raise ValueError(“Too short!”)

if X[0] >

‘n’:

   raise IndexError(“Another word please.”)

if X in Y:

   raise TypeError(“Word is forbidden.”)

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

Consider

the stack trace below. What is the problem? 

File

"C:\Users\lyndo\.spyder-py3\foundations\errors.py", line 21, in

<module>

    z = double()

File

"C:\Users\lyndo\.spyder-py3\foundations\errors.py", line 14, in

double

    return xx

NameError:

name 'xx' is not defined

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

Which is the correct syntax to get the user’s name

as input?

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

What

would the below code do?

with open(“text.txt”)

as f:

              for line in f:

                             print(line.replace(‘

‘,’’))

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

What is the output of the below code?

message

= “My name is {}, I am {:.2f}% Irish”.format(“Sean”,14.7)

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

Хочете миттєвий доступ до всіх перевірених відповідей на moodle.modul.ac.at?

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