GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Quiz

Python knoledge

Alejandro Arboleda 9 Fragen 1,0 (1 Bewertung)

Quiz starten

Dieses Quiz enthält Fragetypen, die sich im gewohnten Player öffnen.

Fragen in diesem Quiz (9)

  1. 1Python was created by:Bild zu Frage 1
    1. AMahomaBild zu Antwort A
    2. BGuido Van RossumBild zu Antwort B
    3. CJesús de NazarethBild zu Antwort C
    4. DAlá OrdenBild zu Antwort D
  2. 2Which of the following expressions mutate, i.e., change, list my_list?
    1. Amy_list.reverse()
    2. Bmy_list.extend([10, 20])
    3. Cmy_list + [10, 20]
    4. Dmy_list.append(10)
    5. Eanother_list.extend(my_list)
  3. 3Every class definition should include an initializer method. Is _init_ that method?
    1. ARichtig
    2. BFalsch
  4. 4We can loop over strings, too!

    The following incomplete function is a simple, but inefficient, way to reverse a string. What line of code needs to replace the questions marks for the code to work correctly?

    def reverse_string(s):
    """Returns the reversal of the given string."""
    [blank_start]result[blank_end] = ""
    for char in s:
    result = char + result
    return result
    print reverse_string("hello")
    Bild zu Frage 4
    1. Aresult - return
  5. 5Imagine a game on a map. At the beginning, we might want to randomly assign each player a starting point. Which of the following expressions may we use in place of the question marks to correctly implement this functionality?
    import random

    def random_point():
    """Returns a random point on a 100x100 grid."""
    return (random.randrange(100), random.randrange(100))

    def starting_points(players):
    """Returns a list of random points, one for each player."""
    points = []
    for player in players:
    point = random_point()
    [blank_start]points.append(point)[blank_end]
    return points
    1. Apoints + point
    2. Bpoints.extend(point)
    3. Cpoint.append(points)
    4. Dpoints.append(point)
    5. Epoints += point
  6. 6The following function is supposed to check whether the given list of numbers is in ascending order. For example, we want is_ascending([2, 6, 9, 12, 400]) to return True, while is_ascending([4, 8, 2, 13]) should return False.

    def is_ascending(numbers):
    """Returns whether the given list of numbers is in ascending order."""
    for i in [blank_start]range(len(numbers)[blank_end]):
    if numbers[i+1] < numbers[i]:
    [blank_start]return False[blank_end]
    return True
    However, the function doesn't quite work. Try it on the suggested tests to verify this for yourself. The easiest fix is to make a small change to the highlighted code. What should it be replaced with?
    1. Arange(len(numbers)
    2. Brange(len(numbers - 1))
    3. Crange(1, len(numbers))
    4. Drange(len(numbers)) - 1
    5. Ereturn False
    6. Freturn false
    7. Greturn true
    8. Hreturn True
  7. 7Is the logo of...Bild zu Frage 7
    1. APython
  8. 8Is logo of...Bild zu Frage 8
    1. AHtml 5
    2. BVisual Studio
    3. CCSS 3
    4. DPython
  9. 9Is the logo of...Bild zu Frage 9
    1. ACSS 3
    2. BPython
    3. CVisual Studio
    4. DHtml 5

Informationen

Beschreibung
Only a test about Python language
Sprache
Español
Aufrufe
131
Bewertung
1,0 von 5 · 1 Bewertung
Bewerte dieses Quiz
Bewerte dieses Quiz

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck