Python Concepts/Quizzes/Functions & classes

{With the follow code the follow happens: - A syntax error as you cannot have assignments in the function argument - An exception is raised as the second argument is missing when making a call to the function + The result is approximately 0.6666 as the second argument is by default 1
 * type=""}

{With the two different definitions: +- The first line in the body of the "second" function is a comment -+ The first line in the body in the 'first' function will make a syntax error as you cannot have a string without an assignment inside a function. +- "first.__doc__" contains the string "Bernoulli numbers computed as 1**m + 2**m + ... + n**m" -+ "second.__doc__" contains the string "Bernoulli numbers computed as 1**m + 2**m + ... + n**m" +- The first definition has a more standard Python documentation than the second definition
 * type=""}
 * True | False

{With the two above code +-  will display the line "Bernoulli numbers computed as 1**m + 2**m + ... + n**m" -+  does not work as "first" is not a module
 * type=""}
 * True | False

{With the follow code we have: +- A class called "Mammal" is defined -+ Mammal is a class derived from Dog +- Dog is a class derived from Mammal
 * type=""}
 * True | False

{With the above code we have: +- "anna" is an instance of "Human". -+  makes an error.
 * type=""}
 * True | False

{We have that -+- Is the name of the constructor method for a class --+ Is the method associated with extending a list with another list
 * type="[]"}
 * __str__ |  __init__  |  __add__

{With the follow code we have -+ b = 4 -+ b = 4L +- b = 13L -+ c = 8 -+ c = 8L +- c = 17L -+ c = 134L
 * type=""}
 * True | False

{We have -+  will result in "True" -+ In  the "or" is not the correct syntax
 * type=""}
 * True | False

{With the follow code -+ The code will print 0 and 1 but finish after 2. -+ You cannot have "else" there: The indentation in the block is wrong -+ "Hello" will be printed several times
 * type=""}
 * True | False

{With the follow code

-+ Clearly there is missing a 'return' statement somewhere -+ Only integers from 1 to 5 are printed -+ As the "while" loop is infinite then the "for" will at one point experience a memory problem when the number of elements gets too big. +- The if sentence examines whether 'n' is divisible with 5 or contains the decimal 5.
 * type=""}
 * True | False