Embercode
✕
Learning with AIQuick quiz

Flashcards and testing AI code

8 questions. Covers Checking AI code with tests.

Questions 1 to 5 of 8

  1. 1. Which front follows the lesson's rule for a flashcard question?
  2. 2. What is the last line this program prints? ``python def next_interval(interval, rating): if rating == 'again': return 1 if rating == 'hard': return max(1, round(interval * 1.2)) if rating == 'good': return max(1, interval * 2) return max(1, interval * 3) gap = 4 for r in ['hard', 'good', 'again']: gap = next_interval(gap, r) print(r, gap) ``
  3. 3. True or false: a card you could answer only after reading its back should be rated Easy, because you did recognise it.
  4. 4. Spot the bug in this test. Which statement is right? ``python import unittest from leap import is_leap_year class TestLeap(unittest.TestCase): def test_1900_is_not_leap(self): try: self.assertFalse(is_leap_year(1900)) except AssertionError: pass ``
  5. 5. What does this program print for the year 1900? ``python def is_leap_year(year): return year % 4 == 0 for y in [1900, 2000, 2023, 2024]: print(y, is_leap_year(y)) ``

5 question(s) left on this page.