fix(curriculum): python for everybody (#38953)

* fix: dictionaries and loops

* fix: dictionaries common applications

* fix: intermediate strings

* fix: introduction elements of python

* fix: networking using urllib in python

* fix: objects a sample class

* fix: python dictionaries

* fix: python lists

* fix: strings and lists

* fix: web services xml

* fix: refactor python questions to md

* fix: refactor questions to md

* fix: remove extra word

Removed unnecessary word is

* fix: add code blocks to answers

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>

* fix: format python code

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
Shaun Hamilton
2020-05-31 13:57:09 +01:00
committed by GitHub
parent 94dee083aa
commit 306a7975f7
56 changed files with 946 additions and 374 deletions

View File

@ -18,19 +18,53 @@ More resources:
```yml ```yml
question: question:
text: 'What will the following Python program print out?: text: |
<pre>def fred():<br> print("Zap")<br><br>def jane():<br> print("ABC")<br> What will the following Python program print out?:
<br> ```python
jane()<br> def fred():
fred()<br> print("Zap")
jane()<br> def jane():
</pre>' print("ABC")
jane()
fred()
jane()
```
answers: answers:
- 'Zap ABC jane fred jane' - |
- 'Zap ABC Zap' Zap
- 'ABC Zap jane'
- 'ABC Zap ABC' ABC
- 'Zap Zap Zap'
jane
fred
jane
- |
Zap
ABC
Zap
- |
ABC
Zap
jane
- |
ABC
Zap
ABC
- |
Zap
Zap
Zap
solution: 4 solution: 4
``` ```

View File

@ -18,13 +18,33 @@ More resources:
```yml ```yml
question: question:
text: 'Which does the same thing as the following code?: text: |
<pre>lst = []<br>for key, val in counts.items():<br> newtup = (val, key)<br> lst.append(newtup)<br><br>lst = sorted(lst, reverse=True)<br>print(lst)<pre>' Which does the same thing as the following code?:
```python
lst = []
for key, val in counts.items():
newtup = (val, key)
lst.append(newtup)
lst = sorted(lst, reverse=True)
print(lst)
```
answers: answers:
- 'print( sorted( [ (k,v) for k,v in counts.items() ] ) )' - |
- 'print( [ (k,v) for k,v in counts.items().sorted() ] )' ```python
- 'print( sorted( [ (k,v) for k,v in counts.keys() ] ) )' print( sorted( [ (v,k) for k,v in counts.items() ] ) )
- 'print( [ (k,v) for k,v in counts.values().sort() ] )' ```
- |
```python
print( [ (k,v) for k,v in counts.items().sorted() ] )
```
- |
```python
print( sorted( [ (v,k) for k,v in counts.keys() ] ) )
```
- |
```python
print( [ (k,v) for k,v in counts.values().sort() ] )
```
solution: 1 solution: 1
``` ```

View File

@ -17,12 +17,34 @@ videoId: gz_IfIsZQtc
```yml ```yml
question: question:
text: 'Which code is indented correctly to print "Yes" if x = 0 and y = 10?' text: |
Which code is indented correctly to print "Yes" if x = 0 and y = 10?
answers: answers:
- '<pre>if 0 == x:<br>if y == 10:<br>print("Yes")</pre>' - |
- '<pre>if 0 == x:<br> if y == 10:<br> print("Yes")</pre>' ```python
- '<pre>if 0 == x:<br>if y == 10:<br> print("Yes")</pre>' if 0 == x:
- '<pre>if 0 == x:<br> if y == 10:<br> print("Yes")</pre>' if y == 10:
print("Yes")
```
- |
```python
if 0 == x:
if y == 10:
print("Yes")
```
- |
```python
if 0 == x:
if y == 10:
print("Yes")
```
- |
```python
if 0 == x:
if y == 10:
print("Yes")
```
solution: 4 solution: 4
``` ```

View File

@ -24,12 +24,18 @@ More resources:
```yml ```yml
question: question:
text: 'Which is a common JavaScript visualization library?' text: |
Which is a common JavaScript visualization library?
answers: answers:
- 'DataViz.js' - |
- 'D3' DataViz.js
- 'Lowcharts' - |
- 'DATA6' D3
- |
Lowcharts
- |
DATA6
solution: 2 solution: 2
``` ```

View File

@ -17,11 +17,16 @@ videoId: 6-w_qIUwaxU
```yml ```yml
question: question:
text: 'How does the page rank algorithm work?' text: |
How does the PageRank algorithm work?
answers: answers:
- 'It determines which pages are most highly connected.' - |
- 'It ranks pages based on view counts.' It determines which pages are most highly connected.
- 'It figures out which pages contain the most important content.' - |
It ranks pages based on view counts.
- |
It figures out which pages contain the most important content.
solution: 1 solution: 1
``` ```

View File

@ -18,14 +18,29 @@ More resources:
```yml ```yml
question: question:
text: "What will the following code print?: text: |
<pre>counts = { 'chuck' : 1 , 'annie' : 42, 'jan': 100}<br> What will the following code print?:
for key in counts:<br> if counts[key] > 10 :<br> print(key, counts[key])</pre>" ```python
counts = { 'chuck' : 1 , 'annie' : 42, 'jan': 100}
for key in counts:
if counts[key] > 10:
print(key, counts[key])
```
answers: answers:
- 'annie 42<br>jan 100<br>' - |
- 'chuck 1<br>annie 42<br>jan 100' annie 42
- 'chuck 1'
- '[Error]' jan 100
- |
chuck 1
annie 42
jan 100
- |
chuck 1
- |
[Error]
solution: 1 solution: 1
``` ```

View File

@ -17,15 +17,23 @@ videoId: f17xPfIXct0
```yml ```yml
question: question:
text: "What will the following code print? text: |
<pre>counts = { 'quincy' : 1 , 'mrugesh' : 42, 'beau': 100, '0': 10}<br> What will the following code print?
print(counts.get('kris', 0))</pre>" ```python
counts = { 'quincy' : 1 , 'mrugesh' : 42, 'beau': 100, '0': 10}
print(counts.get('kris', 0))
```
answers: answers:
- '1' - |
- 'quincy' 2
- '0' - |
- '10' quincy
- '[will return error]' - |
0
- |
10
- |
[will return error]
solution: 3 solution: 3
``` ```

View File

@ -18,12 +18,18 @@ More resources:
```yml ```yml
question: question:
text: "What does the word 'continue' do in the middle of a loop?" text: |
What does the word 'continue' do in the middle of a loop?
answers: answers:
- 'Skips to the code directly after the loop.' - |
- 'Skips to the next line in the code.' Skips to the code directly after the loop.
- 'Skips to the next iteration of the loop.' - |
- 'Skips the next block of code.' Skips to the next line in the code.
- |
Skips to the next iteration of the loop.
- |
Skips the next block of code.
solution: 3 solution: 3
``` ```

View File

@ -19,13 +19,24 @@ More resources:
```yml ```yml
question: question:
text: 'What will print out after running this code:<pre>width = 15<br>height = 12.0<br>print(height/3)</pre>' text: |
What will print out after running this code:
```python
width = 15
height = 12.0
print(height/3)
```
answers: answers:
- '39' - |
- '4' 39
- '4.0' - |
- '5.0' 4
- '5' - |
4.0
- |
5.0
- |
5
solution: 3 solution: 3
``` ```

View File

@ -18,15 +18,23 @@ More resources:
```yml ```yml
question: question:
text: 'What is the value of i in the following code? text: |
<pre>word = "bananana"<br> What is the value of i in the following code?
i = word.find("na")</pre>' ```python
word = "bananana"
i = word.find("na")
```
answers: answers:
- 'nanana' - |
- '2' nanana
- '3' - |
- 'True' 2
- 'na' - |
3
- |
True
- |
na
solution: 2 solution: 2
``` ```

View File

@ -17,14 +17,20 @@ videoId: aRY_xjL35v0
```yml ```yml
question: question:
text: 'What will the following program print out: text: |
<pre>x = 43<br> What will the following program print out:
x = x + 1<br> ```python
print(x)</pre>' x = 43
x = x + 1
print(x)
```
answers: answers:
- 'x' - |
- 'x + 1' x
- '44' - |
x + 1
- |
44
solution: 3 solution: 3
``` ```

View File

@ -21,11 +21,16 @@ videoId: H6qtjRTfSog
```yml ```yml
question: question:
text: 'Where are your programs stored when they are running?' text: |
Where are your programs stored when they are running?
answers: answers:
- 'Hard Drive.' - |
- 'Memory.' Hard Drive.
- 'Central Processing Unit.' - |
Memory.
- |
Central Processing Unit.
solution: 2 solution: 2
``` ```

View File

@ -21,13 +21,21 @@ videoId: 0QeGbZNS_bY
```yml ```yml
question: question:
text: 'What will print out after running these two lines of code: text: |
<pre>x = 6<br>print(x)</pre>' What will print out after running these two lines of code:
```python
x = 6
print(x)
```
answers: answers:
- 'x' - |
- '6' x
- 'x = 6' - |
- '(x)' 6
- |
x = 6
- |
(x)
solution: 2 solution: 2
``` ```

View File

@ -19,11 +19,16 @@ More resources:
```yml ```yml
question: question:
text: 'Who should learn to program?' text: |
Who should learn to program?
answers: answers:
- 'College students.' - |
- 'People who want to become software developers.' College students.
- 'Everyone.' - |
People who want to become software developers.
- |
Everyone.
solution: 3 solution: 3
``` ```

View File

@ -17,13 +17,21 @@ videoId: hiRTRAqNlpE
```yml ```yml
question: question:
text: 'How many lines will the following code print?: text: |
<pre>for i in [2,1,5]:<br> print(i)</pre>' How many lines will the following code print?:
```python
for i in [2,1,5]:
print(i)
```
answers: answers:
- '1' - |
- '2' 1
- '3' - |
- '5' 2
- |
3
- |
5
solution: 3 solution: 3
``` ```

View File

@ -17,22 +17,27 @@ videoId: AelGAcoMXbI
```yml ```yml
question: question:
text: 'Below is code to find the smallest value from a list of values. One line has an error that will cause the code to not work as expected. Which line is it?: text: |
<pre> Below is code to find the smallest value from a list of values. One line has an error that will cause the code to not work as expected. Which line is it?:
1|smallest = None<br> ```python
2|print("Before:", smallest)<br> smallest = None
3|for itervar in [3, 41, 12, 9, 74, 15]:<br> print("Before:", smallest)
4| if smallest is None or itervar < smallest:<br> for itervar in [3, 41, 12, 9, 74, 15]:
5| smallest = itervar<br> if smallest is None or itervar < smallest:
6| break<br> smallest = itervar
7| print("Loop:", itervar, smallest)<br> break
8|print("Smallest:", smallest)<br> print("Loop:", itervar, smallest)
</pre>' print("Smallest:", smallest)
```
answers: answers:
- '3' - |
- '4' 3
- '6' - |
- '7' 4
- |
6
- |
7
solution: 3 solution: 3
``` ```

View File

@ -18,12 +18,26 @@ More resources:
```yml ```yml
question: question:
text: 'Which of these evaluates to False?' text: |
Which of these evaluates to False?
answers: answers:
- '0 == 0.0' - |
- '0 is 0.0' ```python
- '0 is not 0.0' 0 == 0.0
- '0 = 0.0' ```
- |
```python
0 is 0.0
```
- |
```python
0 is not 0.0
```
- |
```python
0 = 0.0
```
solution: 2 solution: 2
``` ```

View File

@ -17,15 +17,41 @@ videoId: dLA-szNRnUY
```yml ```yml
question: question:
text: 'What will the following code print out?: text: |
<pre> What will the following code print out?:
n = 0<br> ```python
while True:<br> if n == 3:<br> break<br> print(n)<br> n = n + 1</pre>' n = 0
while True:
if n == 3:
break
print(n)
n = n + 1
```
answers: answers:
- '0<br>1<br>2' - |
- '0<br>1<br>2<br>3' 0
- '1<br>2'
- '1<br>2<br>3' 1
2
- |
0
1
2
3
- |
1
2
- |
1
2
3
solution: 1 solution: 1
``` ```

View File

@ -17,13 +17,30 @@ videoId: MQ5z4bdF92U
```yml ```yml
question: question:
text: 'What SQL command would you use to retrieve all users that have the email address quincy@freecodecamp.org?' text: |
What SQL command would you use to retrieve all users that have the email address quincy@freecodecamp.org?
answers: answers:
- 'SELECT Users WHERE email="quincy@freecodecamp.org"' - |
- 'SELECT Users WHERE email IS "quincy@freecodecamp.org"' ```
- 'SELECT ALL Users WHERE email="quincy@freecodecamp.org"' SELECT Users WHERE email="quincy@freecodecamp.org"
- 'SELECT * FROM Users WHERE email IS "quincy@freecodecamp.org"' ```
- 'SELECT * FROM Users WHERE email="quincy@freecodecamp.org"' - |
```
SELECT Users WHERE email IS "quincy@freecodecamp.org"
```
- |
```
SELECT ALL Users WHERE email="quincy@freecodecamp.org"
```
- |
```
SELECT * FROM Users WHERE email IS "quincy@freecodecamp.org"
```
- |
```
SELECT * FROM Users WHERE email="quincy@freecodecamp.org"
```
solution: 5 solution: 5
``` ```

View File

@ -19,23 +19,31 @@ More resources:
```yml ```yml
question: question:
text: 'Given the following code:<pre> text: |
1 |temp = "5 degrees"<br> Given the following code:
2 |cel = 0<br> ```python
3 |try:<br> temp = "5 degrees"
4 | fahr = float(temp)<br> cel = 0
5 | cel = (fahr - 32.0) * 5.0 / 9.0<br> try:
6 |except:<br> fahr = float(temp)
7 | print("temp should be a number")<br> cel = (fahr - 32.0) * 5.0 / 9.0
8 |print(cel)<br> except:
</pre> print("temp should be a number")
Which line would cause the script to immediately stop because of an error?' print(cel)
```
Which line would cause the script to immediately stop because of an error?
answers: answers:
- '1' - |
- '4' 1
- '6' - |
- '7' 4
- 'None' - |
6
- |
7
- |
None
solution: 2 solution: 2
``` ```

View File

@ -17,12 +17,18 @@ videoId: c6vZGescaSc
```yml ```yml
question: question:
text: 'What type of HTTP request is usually used to access a website?' text: |
What type of HTTP request is usually used to access a website?
answers: answers:
- 'POST' - |
- 'GET' POST
- 'WEB' - |
- 'ACCESS' GET
- |
WEB
- |
ACCESS
solution: 2 solution: 2
``` ```

View File

@ -17,11 +17,16 @@ videoId: Pv_pJgVu8WI
```yml ```yml
question: question:
text: 'Which type of encoding do most websites use?' text: |
Which type of encoding do most websites use?
answers: answers:
- 'UTF-8' - |
- 'UTF-16' UTF-8
- 'UTF-32' - |
UTF-16
- |
UTF-32
solution: 1 solution: 1
``` ```

View File

@ -17,15 +17,21 @@ videoId: 7lFM1T_CxBs
```yml ```yml
question: question:
text: "What will the output of the following code be like?: text: |
<pre>import urllib.request<br> What will the output of the following code be like?:
<br> ```python
fhand = urllib.request.urlopen('http://data.pr4e.org/romeo.txt')<br> import urllib.request
for line in fhand:<br> print(line.decode().strip())</pre>" fhand = urllib.request.urlopen('http://data.pr4e.org/romeo.txt')
for line in fhand:
print(line.decode().strip())
```
answers: answers:
- 'Just contents of "romeo.txt".' - |
- 'A header and the contents of "romeo.txt".' Just contents of "romeo.txt".
- 'A header, a footer, and the contents of "romeo.txt".' - |
A header and the contents of "romeo.txt".
- |
A header, a footer, and the contents of "romeo.txt".
solution: 1 solution: 1
``` ```

View File

@ -20,15 +20,24 @@ More resources:
```yml ```yml
question: question:
text: 'What Python library is used for parsing HTML documents and extracting data from HTML documents?' text: |
What Python library is used for parsing HTML documents and extracting data from HTML documents?
answers: answers:
- 'socket' - |
- 'http' socket
- 'BeautifulSoup' - |
- 'PrettyBiscuit' http
- 'WonderfulSalad' - |
- 'HttpParser' BeautifulSoup
- 'GrunkleStan' - |
PrettyBiscuit
- |
WonderfulSalad
- |
HttpParser
- |
GrunkleStan
solution: 3 solution: 3
``` ```

View File

@ -17,12 +17,18 @@ videoId: _kJvneKVdNM
```yml ```yml
question: question:
text: 'What Python library gives access to TCP Sockets?' text: |
What Python library gives access to TCP Sockets?
answers: answers:
- 'tcp' - |
- 'socket' tcp
- 'http' - |
- 'port' socket
- |
http
- |
port
solution: 2 solution: 2
``` ```

View File

@ -37,10 +37,14 @@ question:
``` ```
answers: answers:
- 'A simple web server.' - |
- 'A simple email client.' A simple web server.
- 'A simple todo list.' - |
- 'A simple web browser.' A simple email client.
- |
A simple todo list.
- |
A simple web browser.
solution: 4 solution: 4
``` ```

View File

@ -17,20 +17,57 @@ videoId: p1r3h_AMMIM
```yml ```yml
question: question:
text: "What will the following program print?: text: |
<pre> What will the following program print?:
class PartyAnimal:<br> x = 0<br> name = ''<br> def __init__(self, nam):<br> self.name = nam<br> print(self.name,'constructed')<br><br> def party(self):<br> self.x = self.x + 1<br> print(self.name,'party count',self.x)<br> ```python
<br> class PartyAnimal:
q = PartyAnimal('Quincy')<br> x = 0
m = PartyAnimal('Miya')<br> name = ''
<br> def __init__(self, nam):
q.party()<br> self.name = nam
m.party()<br> print(self.name,'constructed')
q.party()" def party(self):
self.x = self.x + 1
print(self.name,'party count',self.x)
q = PartyAnimal('Quincy')
m = PartyAnimal('Miya')
q.party()
m.party()
q.party()
```
answers: answers:
- 'Quincy constructed<br>Miya constructed<br>Quincy party count 1<br>Miya party count 2<br>Quincy party count 3' - |
- 'Quincy constructed<br>Miya constructed<br>Quincy party count 1<br>Miya party count 1<br>Quincy party count 2' Quincy constructed
- 'Quincy constructed<br>Quincy party count 1<br>Quincy party count 2<br>Miya constructed<br>Miya party count 1'
Miya constructed
Quincy party count 1
Miya party count 2
Quincy party count 3
- |
Quincy constructed
Miya constructed
Quincy party count 1
Miya party count 1
Quincy party count 2
- |
Quincy constructed
Quincy party count 1
Quincy party count 2
Miya constructed
Miya party count 1
solution: 2 solution: 2
``` ```

View File

@ -17,17 +17,36 @@ videoId: FiABKEuaSJ8
```yml ```yml
question: question:
text: 'What will the following program print?: text: |
<pre>class PartyAnimal:<br> x = 0<br><br> def party(self) :<br> self.x = self.x + 2<br> print(self.x)<br> What will the following program print?:
<br> ```python
an = PartyAnimal()<br> class PartyAnimal:
an.party()<br> x = 0
an.party()</pre>' def party(self):
self.x = self.x + 2
print(self.x)
an = PartyAnimal()
an.party()
an.party()
```
answers: answers:
- 'So far 1<br>So far 2' - |
- '0<br>0' So far 1
- '2<br>2'
- '1<br>2' So far 2
- |
0
0
- |
2
2
- |
2
4
solution: 4 solution: 4
``` ```

View File

@ -17,12 +17,18 @@ videoId: FBL3alYrxRM
```yml ```yml
question: question:
text: 'What is inheritance in object-oriented programming?' text: |
What is inheritance in object-oriented programming?
answers: answers:
- 'A new class created when a parent class is extended.' - |
- 'A constructed instance of a class.' A new class created when a parent class is extended.
- 'The ability to create a new class by extending an existing class.' - |
- 'A method that is called at the moment when a class is being used to construct an object. ' A constructed instance of a class.
- |
The ability to create a new class by extending an existing class.
- |
A method that is called at the moment when a class is being used to construct an object.
solution: 3 solution: 3
``` ```

View File

@ -17,17 +17,35 @@ videoId: dnzvfimrRMg
```yml ```yml
question: question:
text: 'What does dict equal after running this code?: text: |
<pre>dict = {"Fri": 20, "Thu": 6, "Sat": 1}<br> What does dict equal after running this code?:
dict["Thu"] = 13<br> ```python
dict["Sat"] = 2<br> dict = {"Fri": 20, "Thu": 6, "Sat": 1}
dict["Sun"] = 9</pre>' dict["Thu"] = 13
dict["Sat"] = 2
dict["Sun"] = 9
```
answers: answers:
- "{'Fri': 20, 'Thu': 6, 'Sat': 1}" - |
- "{'Fri': 20, 'Thu': 6, 'Sat': 1, 'Thu': 13, 'Sat': 2, 'Sun': 9}" ```python
- "{'Sun': 9}" {'Fri': 20, 'Thu': 6, 'Sat': 1}
- "{'Thu': 13, 'Sat': 2, 'Sun': 9}" ```
- "{'Fri': 20, 'Thu': 13, 'Sat': 2, 'Sun': 9}" - |
```python
{'Fri': 20, 'Thu': 6, 'Sat': 1, 'Thu': 13, 'Sat': 2, 'Sun': 9}
```
- |
```python
{'Sun': 9}
```
- |
```python
{'Thu': 13, 'Sat': 2, 'Sun': 9}
```
- |
```python
{'Fri': 20, 'Thu': 13, 'Sat': 2, 'Sun': 9}
```
solution: 5 solution: 5
``` ```

View File

@ -17,13 +17,20 @@ videoId: 3JGF-n3tDPU
```yml ```yml
question: question:
text: 'What is the purpose of the "def" keyword in Python?' text: |
What is the purpose of the "def" keyword in Python?
answers: answers:
- 'It is slang that means "The following code is really cool."' - |
- 'It indicates the start of a function.' It is slang that means "The following code is really cool."
- 'It indicates that the following indented section of code is to be stored for later.' - |
- 'b and c are both true.' It indicates the start of a function.
- 'None of the above.' - |
It indicates that the following indented section of code is to be stored for later.
- |
It indicates the start of a function, and the following indented section of code is to be stored for later.
- |
None of the above.
solution: 4 solution: 4
``` ```

View File

@ -17,14 +17,21 @@ videoId: Y0cvfDpYC_c
```yml ```yml
question: question:
text: 'What is the value of x after running this code: text: |
<pre>fruit = "banana"<br> What is the value of x after running this code:
x = fruit[1]</pre>' ```python
fruit = "banana"
x = fruit[1]
```
answers: answers:
- 'banana' - |
- 'a' banana
- 'b' - |
- 'True' a
- |
b
- |
True
solution: 2 solution: 2
``` ```

View File

@ -17,12 +17,18 @@ videoId: uJxGeTYy0us
```yml ```yml
question: question:
text: 'Which is NOT true about objects in Python?' text: |
Which is NOT true about objects in Python?
answers: answers:
- 'Objects get created and used.' - |
- 'Objects are bits of code and data.' Objects get created and used.
- 'Objects hide detail.' - |
- 'Objects are one of the five standard data types.' Objects are bits of code and data.
- |
Objects hide detail.
- |
Objects are one of the five standard data types.
solution: 4 solution: 4
``` ```

View File

@ -17,13 +17,20 @@ videoId: Fo1tW09KIwo
```yml ```yml
question: question:
text: 'What is used to indicate a new line in a string?' text: |
What is used to indicate a new line in a string?
answers: answers:
- '\n' - |
- '{new_line}' \n
- '{n}' - |
- '/n' {new_line}
- '/new' - |
{n}
- |
/n
- |
/new
solution: 1 solution: 1
``` ```

View File

@ -17,17 +17,23 @@ videoId: LaCZnTbQGkE
```yml ```yml
question: question:
text: "What will the following program print?: text: |
<pre> What will the following program print?:
import re<br> ```python
s = 'A message from csev@umich.edu to cwen@iupui.edu about meeting @2PM'<br> import re
lst = re.findall('\\S+@\\S+', s)<br> s = 'A message from csev@umich.edu to cwen@iupui.edu about meeting @2PM'
print(lst)</pre>" lst = re.findall('\\S+@\\S+', s)
print(lst)
```
answers: answers:
- "['csev@umich.edu', 'cwen@iupui.edu']" - |
- "['csev@umich.edu']" ['csev@umich.edu', 'cwen@iupui.edu']
- "['umich.edu', 'iupui.edu']" - |
- "['csev@', 'cwen@']" ['csev@umich.edu']
- |
['umich.edu', 'iupui.edu']
- |
['csev@', 'cwen@']
solution: 1 solution: 1
``` ```

View File

@ -17,12 +17,18 @@ videoId: xCjFU9G6x48
```yml ```yml
question: question:
text: 'What will search for a "$" in a regular expression?' text: |
What will search for a "$" in a regular expression?
answers: answers:
- '$' - |
- '\dollar\' $
- '\$' - |
- '!$' \dollar\
- |
\$
- |
!$
solution: 3 solution: 3
``` ```

View File

@ -17,13 +17,20 @@ videoId: Yud_COr6pZo
```yml ```yml
question: question:
text: 'Which regex matches a white space character?' text: |
Which regex only matches a white space character?
answers: answers:
- '\S' - |
- '\s' \S
- '.' - |
- '\_' \s
- '\.' - |
.
- |
\_
- |
\\.
solution: 2 solution: 2
``` ```

View File

@ -17,12 +17,18 @@ videoId: AqdfbrpkbHk
```yml ```yml
question: question:
text: 'What is the best practice for how many times a piece of string data should be stored in a database?' text: |
What is the best practice for how many times a piece of string data should be stored in a database?
answers: answers:
- '0' - |
- '1' 0
- '2' - |
- '3' 1
- |
2
- |
3
solution: 2 solution: 2
``` ```

View File

@ -17,12 +17,18 @@ videoId: QlNod5-kFpA
```yml ```yml
question: question:
text: 'Which is NOT a primary data structure in a database?' text: |
Which is NOT a primary data structure in a database?
answers: answers:
- 'index' - |
- 'table' index
- 'row' - |
- 'column' table
- |
row
- |
column
solution: 1 solution: 1
``` ```

View File

@ -17,11 +17,16 @@ videoId: jvDw3D9GKac
```yml ```yml
question: question:
text: 'When using a JOIN clause in an SQL statement, what does ON do?' text: |
When using a JOIN clause in an SQL statement, what does ON do?
answers: answers:
- 'It indicates what tables to perform the JOIN on.' - |
- 'It specifies the fields to use for the JOIN.' It indicates what tables to perform the JOIN on.
- 'It indicates how the two tables are to be joined.' - |
It specifies the fields to use for the JOIN.
- |
It indicates how the two tables are to be joined.
solution: 3 solution: 3
``` ```

View File

@ -22,12 +22,17 @@ More resources:
```yml ```yml
question: question:
text: 'Which is an example of a many-to-many relationship?' text: |
Which is an example of a many-to-many relationship?
answers: answers:
- 'teacher to student' - |
- 'customer to order' teacher to student
- 'book to pages' - |
- 'city to country' customer to order
- |
book to pages
- |
city to country
solution: 1 solution: 1
``` ```

View File

@ -17,11 +17,16 @@ videoId: A-t18zKJvmo
```yml ```yml
question: question:
text: 'What does the INSERT command do in SQL?' text: |
What does the INSERT command do in SQL?
answers: answers:
- 'It defines a new row by listing the fields we want to include followed by the values we want placed in the new row.' - |
- 'It defines a new column by listing the rows we want to include followed by the values we want placed in the new column.' It defines a new row by listing the fields we want to include followed by the values we want placed in the new row.
- 'It defines a new table by listing the rows and fields we want to include followed by the values that we want placed in the table.' - |
It defines a new column by listing the rows we want to include followed by the values we want placed in the new column.
- |
It defines a new table by listing the rows and fields we want to include followed by the values that we want placed in the table.
solution: 1 solution: 1
``` ```

View File

@ -17,12 +17,18 @@ videoId: -orenCNdC2Q
```yml ```yml
question: question:
text: 'What is a foreign key?' text: |
What is a foreign key?
answers: answers:
- 'A key that is not supposed to be there.' - |
- 'A key that uses non-latin characters.' A key that is not supposed to be there.
- 'A number that points to the primary key of an associated row in a different table.' - |
- 'A key that the "real world" might use to look up a row.' A key that uses non-latin characters.
- |
A number that points to the primary key of an associated row in a different table.
- |
A key that the "real world" might use to look up a row.
solution: 3 solution: 3
``` ```

View File

@ -18,16 +18,23 @@ More resources:
```yml ```yml
question: question:
text: "What does n equal in this code? text: |
<pre>words = 'His e-mail is q-lar@freecodecamp.org'<br> What does n equal in this code?
pieces = words.split()<br> ```python
parts = pieces[3].split('-')<br> words = 'His e-mail is q-lar@freecodecamp.org'
n = parts[1]</pre>" pieces = words.split()
parts = pieces[3].split('-')
n = parts[1]
```
answers: answers:
- 'mail' - |
- 'q' mail
- 'lar' - |
- 'lar@freecodecamp.org' q
- |
lar
- |
lar@freecodecamp.org
solution: 4 solution: 4
``` ```

View File

@ -17,13 +17,45 @@ videoId: LYZj207fKpQ
```yml ```yml
question: question:
text: 'What will the following code print?: text: |
<pre>for n in "banana":<br> print(n)</pre>' What will the following code print?:
```python
for n in "banana":
print(n)
```
answers: answers:
- 'n<br>n' - |
- '0<br>1' n
- '0<br>1<br>2<br>3<br>4<br>5'
- 'b<br>a<br>n<br>a<br>n<br>a' n
- |
0
1
- |
0
1
2
3
4
5
- |
b
a
n
a
n
a
solution: 4 solution: 4
``` ```

View File

@ -17,13 +17,41 @@ videoId: 3Lxpladfh2k
```yml ```yml
question: question:
text: "What will the following code print?: text: |
<pre>d = dict()<br>d['quincy'] = 1<br>d['beau'] = 5<br>d['kris'] = 9<br>for (k,i) in d.items():<br> print(k, i)</pre>" What will the following code print?:
```python
d = dict()
d['quincy'] = 1
d['beau'] = 5
d['kris'] = 9
for (k,i) in d.items():
print(k, i)
```
answers: answers:
- 'k i<br>k i<br>k i' - |
- 'quincy 0<br>beau 1<br>kris 2' k i
- 'quincy 1<br>beau 5<br>kris 9'
- '1 quincy<br>5 beau<br>9 kris' k i
k i
- |
quincy 0
beau 1
kris 2
- |
quincy 1
beau 5
kris 9
- |
1 quincy
5 beau
9 kris
solution: 3 solution: 3
``` ```

View File

@ -17,13 +17,20 @@ videoId: oNl1OVDPGKE
```yml ```yml
question: question:
text: 'What are the two most common ways to send data over the internet?' text: |
What are the two most common ways to send data over the internet?
answers: answers:
- 'JSON and TXT' - |
- 'JSON and XML' JSON and TXT
- 'XML and TXT' - |
- 'XML and PHP' JSON and XML
- 'PHP and TXT' - |
XML and TXT
- |
XML and PHP
- |
PHP and TXT
solution: 2 solution: 2
``` ```

View File

@ -17,12 +17,18 @@ videoId: nELR-uyyrok
```yml ```yml
question: question:
text: 'What is the symbol is used in an assignment statement?' text: |
What is the symbol used in an assignment statement?
answers: answers:
- '~' - |
- '&' ~
- '=' - |
- '|' &
- |
=
- |
|
solution: 3 solution: 3
``` ```

View File

@ -17,13 +17,20 @@ videoId: e3lydkH0prw
```yml ```yml
question: question:
text: 'Most data needs to be ______ before using it.' text: |
Most data needs to be ______ before using it.
answers: answers:
- 'converted to JSON format' - |
- 'graphed' converted to JSON format
- 'cleaned' - |
- 'memorized' graphed
- 'turned into song' - |
cleaned
- |
memorized
- |
turned into song
solution: 3 solution: 3
``` ```

View File

@ -21,12 +21,18 @@ More resources:
```yml ```yml
question: question:
text: 'When making a request from the Twitter API, what information must always be sent with the request?' text: |
When making a request from the Twitter API, what information must always be sent with the request?
answers: answers:
- 'Twitter username' - |
- 'date range' Twitter username
- 'search term' - |
- 'key' date range
- |
search term
- |
key
solution: 4 solution: 4
``` ```

View File

@ -17,12 +17,18 @@ videoId: oUNn1psfBJg
```yml ```yml
question: question:
text: 'What does API stand for?' text: |
What does API stand for?
answers: answers:
- 'Application Portable Intelligence' - |
- 'Associate Programming International' Application Portable Intelligence
- 'Application Program Interface' - |
- 'Action Portable Interface' Associate Programming International
- |
Application Program Interface
- |
Action Portable Interface
solution: 3 solution: 3
``` ```

View File

@ -17,19 +17,36 @@ videoId: ZJE-U56BppM
```yml ```yml
question: question:
text: "What will the following code print?: text: |
<pre>import json<br> What will the following code print?:
<br> ```python
data = '''<br>[<br> { 'id' : '001',<br> 'x' : '2',<br> 'name' : 'Quincy'<br> } ,<br> { 'id' : '009',<br> 'x' : '7',<br> 'name' : 'Mrugesh'<br> }<br>]'''<br> import json
<br> data = '''
info = json.loads(data)<br> [
print(info[1]['name'])</pre>" { 'id' : '001',
'x' : '2',
'name' : 'Quincy'
} ,
{ 'id' : '009',
'x' : '7',
'name' : 'Mrugesh'
}
]
'''
info = json.loads(data)
print(info[1]['name'])
```
answers: answers:
- 'Quincy' - |
- 'Mrugesh' Quincy
- '001' - |
- '009' Mrugesh
- '[Error]' - |
001
- |
009
- |
[Error]
solution: 2 solution: 2
``` ```

View File

@ -17,11 +17,16 @@ videoId: muerlsCHExI
```yml ```yml
question: question:
text: 'With a services oriented approach to developing web apps, where is the data located?' text: |
With a services oriented approach to developing web apps, where is the data located?
answers: answers:
- 'Spread across many computer systems connected via the internet or internal network.' - |
- 'Within different services on the main web server.' Spread across many computer systems connected via the internet or internal network.
- 'On a separate database server.' - |
Within different services on the main web server.
- |
On a separate database server.
solution: 1 solution: 1
``` ```

View File

@ -17,11 +17,16 @@ videoId: yWU9kTxW-nc
```yml ```yml
question: question:
text: 'What is XSD?' text: |
What is XSD?
answers: answers:
- 'The W3C Schema specification for XML.' - |
- 'The standard JSON schema from MOZ.' The W3C Schema specification for XML.
- 'Extensible Situational Driver' - |
The standard JSON schema from MOZ.
- |
Extensible Situational Driver
solution: 1 solution: 1
``` ```

View File

@ -17,17 +17,25 @@ videoId: _pZ0srbg7So
```yml ```yml
question: question:
text: 'What is wrong with the following XML?: text: |
<pre>&ltperson&gt<br> What is wrong with the following XML?:
&ltname>Chuck&lt/name><br> ```xml
&ltphone type="intl"><br> +1 734 303 4456<br> <person>
&ltemail hide="yes" /><br> <name>Chuck</name>
&lt/person></pre>' <phone type="intl">
+1 734 303 4456
<email hide="yes" />
</person>
```
answers: answers:
- 'Email tag is missing closing tag.' - |
- 'Spacing will cause XML to be invalid.' Email tag is missing closing tag.
- 'Phone tag is missing closing tag.' - |
- 'Plain text should be encoded using UTF-8.' Spacing will cause XML to be invalid.
- |
Phone tag is missing closing tag.
- |
Plain text should be encoded using UTF-8.
solution: 3 solution: 3
``` ```

View File

@ -17,12 +17,18 @@ videoId: lCnHfTHkhbE
```yml ```yml
question: question:
text: 'Which method is used to add an item at the end of a list?' text: |
Which method is used to add an item at the end of a list?
answers: answers:
- 'insert' - |
- 'push' insert
- 'append' - |
- 'new' push
- |
append
- |
new
solution: 3 solution: 3
``` ```