|
| 1 | +[python] |
| 2 | +label = "Python" |
| 3 | + |
| 4 | + [[python.questions]] |
| 5 | + question = "When was the first known use of the word 'quiz'" |
| 6 | + answers = ["1781"] |
| 7 | + alternatives = ["1771", "1871", "1881"] |
| 8 | + |
| 9 | + [[python.questions]] |
| 10 | + question = "Which built-in function can get information from the user" |
| 11 | + answers = ["input"] |
| 12 | + alternatives = ["get", "print", "write"] |
| 13 | + |
| 14 | + [[python.questions]] |
| 15 | + question = "What's the purpose of the built-in zip() function" |
| 16 | + answers = ["To iterate over two or more sequences at the same time"] |
| 17 | + alternatives = [ |
| 18 | + "To combine several strings into one", |
| 19 | + "To compress several files into one archive", |
| 20 | + "To get information from the user", |
| 21 | + ] |
| 22 | + |
| 23 | + [[python.questions]] |
| 24 | + question = "What does dict.get(key) return if key isn't found in dict" |
| 25 | + answers = ["None"] |
| 26 | + alternatives = ["key", "True", "False"] |
| 27 | + |
| 28 | + [[python.questions]] |
| 29 | + question = "How do you iterate over both the indices and elements in an iterable" |
| 30 | + answers = ["enumerate(iterable)"] |
| 31 | + alternatives = [ |
| 32 | + "enumerate(iterable, start=1)", |
| 33 | + "range(iterable)", |
| 34 | + "range(iterable, start=1)", |
| 35 | + ] |
| 36 | + |
| 37 | + [[python.questions]] |
| 38 | + question = "What's the official name of the := operator" |
| 39 | + answers = ["Assignment expression"] |
| 40 | + alternatives = [ |
| 41 | + "Named expression", |
| 42 | + "Walrus operator", |
| 43 | + "Colon equals operator", |
| 44 | + ] |
| 45 | + |
| 46 | + [[python.questions]] |
| 47 | + question = "What's one effect of calling random.seed(42)" |
| 48 | + answers = ["The random numbers are reproducible."] |
| 49 | + alternatives = [ |
| 50 | + "The random numbers are more random.", |
| 51 | + "The computer clock is reset.", |
| 52 | + "The first random number is always 42.", |
| 53 | + ] |
| 54 | + |
| 55 | + [[python.questions]] |
| 56 | + question = "Which version of Python is the first with TOML support built in" |
| 57 | + answers = ["3.11"] |
| 58 | + alternatives = ["3.9", "3.10", "3.12"] |
| 59 | + |
| 60 | + [[python.questions]] |
| 61 | + question = "How can you run a Python script named quiz.py" |
| 62 | + answers = ["python quiz.py", "python -m quiz"] |
| 63 | + alternatives = ["python quiz", "python -m quiz.py"] |
| 64 | + hint = "One option uses the filename, and the other uses the module name." |
| 65 | + |
| 66 | + [[python.questions]] |
| 67 | + question = "What's the name of the list-like data structure in TOML" |
| 68 | + answers = ["Array"] |
| 69 | + alternatives = ["List", "Sequence", "Set"] |
| 70 | + |
| 71 | + [[python.questions]] |
| 72 | + question = "What's a PEP" |
| 73 | + answers = ["A Python Enhancement Proposal"] |
| 74 | + alternatives = [ |
| 75 | + "A Pretty Exciting Policy", |
| 76 | + "A Preciously Evolved Python", |
| 77 | + "A Potentially Epic Prize", |
| 78 | + ] |
| 79 | + hint = "PEPs are used to evolve Python." |
| 80 | + explanation = """ |
| 81 | + Python Enhancement Proposals (PEPs) are design documents that provide |
| 82 | + information to the Python community. PEPs are used to propose new features |
| 83 | + for the Python language, to collect community input on an issue, and to |
| 84 | + document design decisions made about the language. |
| 85 | + """ |
| 86 | + |
| 87 | + [[python.questions]] |
| 88 | + question = "How can you add a docstring to a function" |
| 89 | + answers = [ |
| 90 | + "By writing a string literal as the first statement in the function", |
| 91 | + "By assigning a string to the function's .__doc__ attribute", |
| 92 | + ] |
| 93 | + alternatives = [ |
| 94 | + "By using the built-in @docstring decorator", |
| 95 | + "By returning a string from the function", |
| 96 | + ] |
| 97 | + hint = "They are parsed from your code and stored on the function object." |
| 98 | + explanation = """ |
| 99 | + Docstrings document functions and other Python objects. A docstring is a |
| 100 | + string literal that occurs as the first statement in a module, function, |
| 101 | + class, or method definition. Such a docstring becomes the .__doc__ special |
| 102 | + attribute of that object. See PEP 257 for more information. |
| 103 | +
|
| 104 | + There's no built-in @docstring decorator. Many functions naturally return |
| 105 | + strings. Such a feature can therefore not be used for docstrings. |
| 106 | + """ |
| 107 | + |
| 108 | + [[python.questions]] |
| 109 | + question = "When was the first public version of Python released" |
| 110 | + answers = ["February 1991"] |
| 111 | + alternatives = ["January 1994", "October 2000", "December 2008"] |
| 112 | + hint = "The first public version was labeled version 0.9.0." |
| 113 | + explanation = """ |
| 114 | + Guido van Rossum started work on Python in December 1989. He posted |
| 115 | + Python v0.9.0 to the alt.sources newsgroup in February 1991. Python |
| 116 | + reached version 1.0.0 in January 1994. The next major versions, |
| 117 | + Python 2.0 and Python 3.0, were released in October 2000 and December |
| 118 | + 2008, respectively. |
| 119 | + """ |
| 120 | + |
| 121 | +[capitals] |
| 122 | +label = "Capitals" |
| 123 | + |
| 124 | + [[capitals.questions]] |
| 125 | + question = "What's the capital of Norway" |
| 126 | + answers = ["Oslo"] |
| 127 | + hint = "Lars Onsager, Jens Stoltenberg, Trygve Lie, and Børge Ousland." |
| 128 | + alternatives = ["Stockholm", "Copenhagen", "Helsinki", "Reykjavik"] |
| 129 | + explanation = """ |
| 130 | + Oslo was founded as a city in the 11th century and established as a |
| 131 | + trading place. It became the capital of Norway in 1299. The city was |
| 132 | + destroyed by a fire in 1624 and rebuilt as Christiania, named in honor |
| 133 | + of the reigning king. The city was renamed back to Oslo in 1925. |
| 134 | + """ |
| 135 | + |
| 136 | + [[capitals.questions]] |
| 137 | + question = "What's the state capital of Texas, USA" |
| 138 | + answers = ["Austin"] |
| 139 | + alternatives = ["Harrisburg", "Houston", "Galveston", "Columbia"] |
| 140 | + hint = "SciPy is held there each year." |
| 141 | + explanation = """ |
| 142 | + Austin is named in honor of Stephen F. Austin. It was purpose-built to |
| 143 | + be the capital of Texas and was incorporated in December 1839. Houston, |
| 144 | + Harrisburg, Columbia, and Galveston are all earlier capitals of Texas. |
| 145 | + """ |
0 commit comments