logo

Crowdly

Browser

Add to Chrome

Basics in Computer Programming

Looking for Basics in Computer Programming test answers and solutions? Browse our comprehensive collection of verified answers for Basics in Computer Programming at moodle.modul.ac.at.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

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

View this question

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.”)

View this question

Consider

the code below. Which error will be thrown? 

y = 12

print(“How

many eggs in a dozen?” + y)

0%
0%
0%
0%
0%
View this question

How

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

View this question

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%
0%
View this question

What

is the output of the below code?

list = [‘apples’,

‘bananas’, ‘pears’]

string = “;”.join(list)

print(string)

0%
0%
0%
0%
0%
View this question

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%
0%
View this question

What

would the below code do?

with open(“text.txt”)

as f:

              for line in f:

                             print(line.replace(‘

‘,’’))

0%
0%
0%
0%
View this question

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

as input?

0%
0%
0%
0%
0%
View this question

What is the output of the below code?

message

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

0%
0%
0%
0%
0%
View this question

Want instant access to all verified answers on moodle.modul.ac.at?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome