Adding language to code fences and pre to console logs (#40603)
* added languages to prismjs * added language to code fences for python for everybody * multiline pre to python for everybody questions * multiline pre for data analysis with python * multiline pre in numpy questions * single line pre for python for everybody * single line pre for data analysis with python * single line pre for numpy * Revert "multiline pre in numpy questions" This reverts commitaf1a02cdd3
. * fix unneded escaping commit suggestions from code review Co-authored-by: Shaun Hamilton <51722130+ShaunSHamilton@users.noreply.github.com> * Revert "single line pre for numpy" This reverts commit5f90981108
. * revert changes to snippet that have a language * one last code fence to pre * Revert "fix unneded escaping " This reverts commit64c84a9213
. * Revert "single line pre for data analysis with python" This reverts commit3bccaff753
. * Revert "single line pre for python for everybody" This reverts commit03a5379062
. * remove unnecessary escape Co-authored-by: Shaun Hamilton <51722130+ShaunSHamilton@users.noreply.github.com>
This commit is contained in:
@ -62,7 +62,9 @@
|
|||||||
"mathml",
|
"mathml",
|
||||||
"python",
|
"python",
|
||||||
"svg",
|
"svg",
|
||||||
"xml"
|
"xml",
|
||||||
|
"sql",
|
||||||
|
"typescript"
|
||||||
],
|
],
|
||||||
"theme": "default",
|
"theme": "default",
|
||||||
"css": true,
|
"css": true,
|
||||||
|
@ -31,47 +31,35 @@ jane()
|
|||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
Zap
|
<pre>Zap
|
||||||
|
|
||||||
ABC
|
ABC
|
||||||
|
|
||||||
jane
|
jane
|
||||||
|
|
||||||
fred
|
fred
|
||||||
|
jane</pre>
|
||||||
jane
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Zap
|
<pre>Zap
|
||||||
|
|
||||||
ABC
|
ABC
|
||||||
|
Zap</pre>
|
||||||
Zap
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
ABC
|
<pre>ABC
|
||||||
|
|
||||||
Zap
|
Zap
|
||||||
|
jane</pre>
|
||||||
jane
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
ABC
|
<pre>ABC
|
||||||
|
|
||||||
Zap
|
Zap
|
||||||
|
ABC</pre>
|
||||||
ABC
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<pre>Zap
|
||||||
Zap
|
Zap
|
||||||
|
Zap</pre>
|
||||||
Zap
|
|
||||||
|
|
||||||
Zap
|
|
||||||
|
|
||||||
## --video-solution--
|
## --video-solution--
|
||||||
|
|
||||||
|
@ -27,27 +27,23 @@ for key in counts:
|
|||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
|
<pre>annie 42
|
||||||
|
jan 100</pre>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<pre>chuck 1
|
||||||
annie 42
|
annie 42
|
||||||
|
jan 100</pre>
|
||||||
jan 100
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
chuck 1
|
<pre>chuck 1</pre>
|
||||||
|
|
||||||
annie 42
|
|
||||||
|
|
||||||
jan 100
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
chuck 1
|
<pre>[Error]</pre>
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
\[Error]
|
|
||||||
|
|
||||||
## --video-solution--
|
## --video-solution--
|
||||||
|
|
||||||
1
|
1
|
||||||
|
|
||||||
|
@ -23,35 +23,27 @@ while True:
|
|||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
0
|
<pre>0
|
||||||
|
|
||||||
1
|
1
|
||||||
|
2</pre>
|
||||||
2
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
0
|
<pre>0
|
||||||
|
|
||||||
1
|
1
|
||||||
|
|
||||||
2
|
2
|
||||||
|
3</pre>
|
||||||
3
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
1
|
<pre>1
|
||||||
|
2</pre>
|
||||||
2
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
1
|
<pre>1
|
||||||
|
|
||||||
2
|
2
|
||||||
|
3</pre>
|
||||||
3
|
|
||||||
|
|
||||||
## --video-solution--
|
## --video-solution--
|
||||||
|
|
||||||
|
@ -14,31 +14,31 @@ What SQL command would you use to retrieve all users that have the email address
|
|||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
```
|
```sql
|
||||||
SELECT Users WHERE email="quincy@freecodecamp.org"
|
SELECT Users WHERE email="quincy@freecodecamp.org"
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
```sql
|
||||||
SELECT Users WHERE email IS "quincy@freecodecamp.org"
|
SELECT Users WHERE email IS "quincy@freecodecamp.org"
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
```sql
|
||||||
SELECT ALL Users WHERE email="quincy@freecodecamp.org"
|
SELECT ALL Users WHERE email="quincy@freecodecamp.org"
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
```sql
|
||||||
SELECT * FROM Users WHERE email IS "quincy@freecodecamp.org"
|
SELECT * FROM Users WHERE email IS "quincy@freecodecamp.org"
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
```sql
|
||||||
SELECT * FROM Users WHERE email="quincy@freecodecamp.org"
|
SELECT * FROM Users WHERE email="quincy@freecodecamp.org"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -33,39 +33,33 @@ q.party()
|
|||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
|
<pre>
|
||||||
Quincy constructed
|
Quincy constructed
|
||||||
|
|
||||||
Miya constructed
|
Miya constructed
|
||||||
|
|
||||||
Quincy party count 1
|
Quincy party count 1
|
||||||
|
|
||||||
Miya party count 2
|
Miya party count 2
|
||||||
|
|
||||||
Quincy party count 3
|
Quincy party count 3
|
||||||
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<pre>
|
||||||
Quincy constructed
|
Quincy constructed
|
||||||
|
|
||||||
Miya constructed
|
Miya constructed
|
||||||
|
|
||||||
Quincy party count 1
|
Quincy party count 1
|
||||||
|
|
||||||
Miya party count 1
|
Miya party count 1
|
||||||
|
|
||||||
Quincy party count 2
|
Quincy party count 2
|
||||||
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<pre>
|
||||||
Quincy constructed
|
Quincy constructed
|
||||||
|
|
||||||
Quincy party count 1
|
Quincy party count 1
|
||||||
|
|
||||||
Quincy party count 2
|
Quincy party count 2
|
||||||
|
|
||||||
Miya constructed
|
Miya constructed
|
||||||
|
|
||||||
Miya party count 1
|
Miya party count 1
|
||||||
|
</pre>
|
||||||
|
|
||||||
## --video-solution--
|
## --video-solution--
|
||||||
|
|
||||||
|
@ -26,27 +26,31 @@ an.party()
|
|||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
|
<pre>
|
||||||
So far 1
|
So far 1
|
||||||
|
|
||||||
So far 2
|
So far 2
|
||||||
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<pre>
|
||||||
0
|
0
|
||||||
|
|
||||||
0
|
0
|
||||||
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<pre>
|
||||||
2
|
2
|
||||||
|
|
||||||
2
|
2
|
||||||
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<pre>
|
||||||
2
|
2
|
||||||
|
|
||||||
4
|
4
|
||||||
|
</pre>
|
||||||
|
|
||||||
## --video-solution--
|
## --video-solution--
|
||||||
|
|
||||||
|
@ -19,43 +19,39 @@ for n in "banana":
|
|||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
|
<pre>
|
||||||
n
|
n
|
||||||
|
|
||||||
n
|
n
|
||||||
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<pre>
|
||||||
0
|
0
|
||||||
|
|
||||||
1
|
1
|
||||||
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<pre>
|
||||||
0
|
0
|
||||||
|
|
||||||
1
|
1
|
||||||
|
|
||||||
2
|
2
|
||||||
|
|
||||||
3
|
3
|
||||||
|
|
||||||
4
|
4
|
||||||
|
|
||||||
5
|
5
|
||||||
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<pre>
|
||||||
b
|
b
|
||||||
|
|
||||||
a
|
a
|
||||||
|
|
||||||
n
|
n
|
||||||
|
|
||||||
a
|
a
|
||||||
|
|
||||||
n
|
n
|
||||||
|
|
||||||
a
|
a
|
||||||
|
</pre>
|
||||||
|
|
||||||
## --video-solution--
|
## --video-solution--
|
||||||
|
|
||||||
|
@ -23,35 +23,35 @@ for (k,i) in d.items():
|
|||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
|
<pre>
|
||||||
k i
|
k i
|
||||||
|
|
||||||
k i
|
k i
|
||||||
|
|
||||||
k i
|
k i
|
||||||
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<pre>
|
||||||
quincy 0
|
quincy 0
|
||||||
|
|
||||||
beau 1
|
beau 1
|
||||||
|
|
||||||
kris 2
|
kris 2
|
||||||
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<pre>
|
||||||
quincy 1
|
quincy 1
|
||||||
|
|
||||||
beau 5
|
beau 5
|
||||||
|
|
||||||
kris 9
|
kris 9
|
||||||
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<pre>
|
||||||
1 quincy
|
1 quincy
|
||||||
|
|
||||||
5 beau
|
5 beau
|
||||||
|
|
||||||
9 kris
|
9 kris
|
||||||
|
</pre>
|
||||||
|
|
||||||
## --video-solution--
|
## --video-solution--
|
||||||
|
|
||||||
|
@ -36,25 +36,21 @@ print(s.notnull().sum())
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
<pre>0 True
|
||||||
0 True
|
|
||||||
1 True
|
1 True
|
||||||
2 False
|
2 False
|
||||||
3 True
|
3 True
|
||||||
4 False
|
4 False
|
||||||
dtype: bool
|
dtype: bool</pre>
|
||||||
```
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
<pre>0 False
|
||||||
0 False
|
|
||||||
1 False
|
1 False
|
||||||
2 True
|
2 True
|
||||||
3 False
|
3 False
|
||||||
4 True
|
4 True
|
||||||
dtype: bool
|
dtype: bool</pre>
|
||||||
```
|
|
||||||
|
|
||||||
## --video-solution--
|
## --video-solution--
|
||||||
|
|
||||||
|
@ -33,36 +33,36 @@ print(s)
|
|||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
0 1.0
|
0 1.0
|
||||||
1 1.0
|
1 1.0
|
||||||
2 2.0
|
2 2.0
|
||||||
3 3.0
|
3 3.0
|
||||||
4 3.0
|
4 3.0
|
||||||
dtype: float64
|
dtype: float64
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
0 NaN
|
0 NaN
|
||||||
1 1.0
|
1 1.0
|
||||||
2 2.0
|
2 2.0
|
||||||
3 2.0
|
3 2.0
|
||||||
4 3.0
|
4 3.0
|
||||||
dtype: float64
|
dtype: float64
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
0 NaN
|
0 NaN
|
||||||
1 1.0
|
1 1.0
|
||||||
2 2.0
|
2 2.0
|
||||||
3 NaN
|
3 NaN
|
||||||
4 3.0
|
4 3.0
|
||||||
dtype: float64
|
dtype: float64
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
## --video-solution--
|
## --video-solution--
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ print(A[:, :2])
|
|||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
```python
|
```py
|
||||||
[['a' 'b']]
|
[['a' 'b']]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -39,33 +39,33 @@ print(certificates_earned)
|
|||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
Tom 13
|
Tom 13
|
||||||
Kris 11
|
Kris 11
|
||||||
Ahmad 9
|
Ahmad 9
|
||||||
Beau 7
|
Beau 7
|
||||||
Name: Longest streak, dtype: int64
|
Name: Longest streak, dtype: int64
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
Certificates Time (in months) Longest streak
|
Certificates Time (in months) Longest streak
|
||||||
Tom 8 16 13
|
Tom 8 16 13
|
||||||
Kris 2 5 11
|
Kris 2 5 11
|
||||||
Ahmad 5 9 9
|
Ahmad 5 9 9
|
||||||
Beau 6 12 7
|
Beau 6 12 7
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
Certificates Longest streak
|
Certificates Longest streak
|
||||||
Tom 8 13
|
Tom 8 13
|
||||||
Kris 2 11
|
Kris 2 11
|
||||||
Ahmad 5 9
|
Ahmad 5 9
|
||||||
Beau 6 7
|
Beau 6 7
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
## --video-solution--
|
## --video-solution--
|
||||||
|
|
||||||
|
@ -21,13 +21,11 @@ More resources:
|
|||||||
|
|
||||||
What code would add a "Certificates per month" column to the `certificates_earned` DataFrame like the one below?
|
What code would add a "Certificates per month" column to the `certificates_earned` DataFrame like the one below?
|
||||||
|
|
||||||
```
|
<pre> Certificates Time (in months) Certificates per month
|
||||||
Certificates Time (in months) Certificates per month
|
|
||||||
Tom 8 16 0.50
|
Tom 8 16 0.50
|
||||||
Kris 2 5 0.40
|
Kris 2 5 0.40
|
||||||
Ahmad 5 9 0.56
|
Ahmad 5 9 0.56
|
||||||
Beau 6 12 0.50
|
Beau 6 12 0.50</pre>
|
||||||
```
|
|
||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
|
@ -36,29 +36,29 @@ print(certificates_earned.iloc[2])
|
|||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
Tom 16
|
Tom 16
|
||||||
Kris 5
|
Kris 5
|
||||||
Ahmad 9
|
Ahmad 9
|
||||||
Beau 12
|
Beau 12
|
||||||
Name: Time (in months), dtype: int64
|
Name: Time (in months), dtype: int64
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
Certificates 6
|
Certificates 6
|
||||||
Time (in months) 12
|
Time (in months) 12
|
||||||
Name: Beau, dtype: int64
|
Name: Beau, dtype: int64
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
Certificates 5
|
Certificates 5
|
||||||
Time (in months) 9
|
Time (in months) 9
|
||||||
Name: Ahmad, dtype: int64
|
Name: Ahmad, dtype: int64
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
## --video-solution--
|
## --video-solution--
|
||||||
|
|
||||||
|
@ -34,30 +34,30 @@ print(certificates_earned[certificates_earned > 5])
|
|||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
Tom True
|
Tom True
|
||||||
Kris False
|
Kris False
|
||||||
Ahmad False
|
Ahmad False
|
||||||
Beau True
|
Beau True
|
||||||
dtype: int64
|
dtype: int64
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
Tom 8
|
Tom 8
|
||||||
Ahmad 5
|
Ahmad 5
|
||||||
Beau 6
|
Beau 6
|
||||||
dtype: int64
|
dtype: int64
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
Tom 8
|
Tom 8
|
||||||
Beau 6
|
Beau 6
|
||||||
dtype: int64
|
dtype: int64
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
## --video-solution--
|
## --video-solution--
|
||||||
|
|
||||||
|
@ -21,13 +21,13 @@ More resources:
|
|||||||
|
|
||||||
Given a file named `certificates.csv` with these contents:
|
Given a file named `certificates.csv` with these contents:
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
Name$Certificates$Time (in months)
|
Name$Certificates$Time (in months)
|
||||||
Tom$8$16
|
Tom$8$16
|
||||||
Kris$2$5
|
Kris$2$5
|
||||||
Ahmad$5$9
|
Ahmad$5$9
|
||||||
Beau$6$12
|
Beau$6$12
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
Fill in the blanks for the missing arguments below:
|
Fill in the blanks for the missing arguments below:
|
||||||
|
|
||||||
|
@ -12,10 +12,10 @@ dashedName: loading-data-and-advanced-indexing
|
|||||||
|
|
||||||
Given a file named `data.txt` with these contents:
|
Given a file named `data.txt` with these contents:
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
29,97,32,100,45
|
29,97,32,100,45
|
||||||
15,88,5,75,22
|
15,88,5,75,22
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
What code would produce the following array?
|
What code would produce the following array?
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user