single line pre for python for everybody

This commit is contained in:
ieahleen
2021-01-01 18:39:23 +00:00
parent af1a02cdd3
commit 03a5379062
17 changed files with 118 additions and 96 deletions

View File

@ -30,35 +30,45 @@ jane()
## --answers-- ## --answers--
<pre>Zap <pre>
Zap
ABC ABC
jane jane
fred fred
jane</pre> jane
</pre>
--- ---
<pre>Zap <pre>
Zap
ABC ABC
Zap</pre> Zap
</pre>
--- ---
<pre>ABC <pre>
ABC
Zap Zap
jane</pre> jane
</pre>
--- ---
<pre>ABC <pre>
ABC
Zap Zap
ABC</pre> ABC
</pre>
--- ---
<pre>Zap <pre>
Zap Zap
Zap</pre> Zap
Zap
</pre>
## --video-solution-- ## --video-solution--

View File

@ -26,14 +26,18 @@ for key in counts:
## --answers-- ## --answers--
<pre>annie 42 <pre>
jan 100</pre> annie 42
jan 100
</pre>
--- ---
<pre>chuck 1 <pre>
chuck 1
annie 42 annie 42
jan 100</pre> jan 100
</pre>
--- ---

View File

@ -18,23 +18,23 @@ print(counts.get('kris', 0))
## --answers-- ## --answers--
2 <pre>2</pre>
--- ---
quincy <pre>quincy</pre>
--- ---
0 <pre>0</pre>
--- ---
10 <pre>10</pre>
--- ---
[will return error] <pre>[will return error]</pre>
## --video-solution-- ## --video-solution--

View File

@ -27,23 +27,23 @@ print(height/3)
## --answers-- ## --answers--
39 <pre>39</pre>
--- ---
4 <pre>4</pre>
--- ---
4.0 <pre>4.0</pre>
--- ---
5.0 <pre>5.0</pre>
--- ---
5 <pre>5</pre>
## --video-solution-- ## --video-solution--

View File

@ -24,23 +24,23 @@ i = word.find("na")
## --answers-- ## --answers--
nanana <pre>nanana</pre>
--- ---
2 <pre>2</pre>
--- ---
3 <pre>3</pre>
--- ---
True <pre>True</pre>
--- ---
na <pre>na</pre>
## --video-solution-- ## --video-solution--

View File

@ -19,15 +19,15 @@ print(x)
## --answers-- ## --answers--
x <pre>x</pre>
--- ---
x + 1 <pre>x + 1</pre>
--- ---
44 <pre>44</pre>
## --video-solution-- ## --video-solution--

View File

@ -18,19 +18,19 @@ print(x)
## --answers-- ## --answers--
x <pre>x</pre>
--- ---
6 <pre>6</pre>
--- ---
x = 6 <pre>x = 6</pre>
--- ---
(x) <pre>(x)</pre>
## --video-solution-- ## --video-solution--

View File

@ -22,27 +22,35 @@ while True:
## --answers-- ## --answers--
<pre>0 <pre>
1 0
2</pre>
---
<pre>0
1 1
2 2
3</pre> </pre>
--- ---
<pre>1 <pre>
2</pre> 0
1
---
<pre>1
2 2
3</pre> 3
</pre>
---
<pre>
1
2
</pre>
---
<pre>
1
2
3
</pre>
## --video-solution-- ## --video-solution--

View File

@ -20,33 +20,33 @@ dict["Sun"] = 9
## --answers-- ## --answers--
```python <pre>
{'Fri': 20, 'Thu': 6, 'Sat': 1} {'Fri': 20, 'Thu': 6, 'Sat': 1}
``` </pre>
--- ---
```python <pre>
{'Fri': 20, 'Thu': 6, 'Sat': 1, 'Thu': 13, 'Sat': 2, 'Sun': 9} {'Fri': 20, 'Thu': 6, 'Sat': 1, 'Thu': 13, 'Sat': 2, 'Sun': 9}
``` </pre>
--- ---
```python <pre>
{'Sun': 9} {'Sun': 9}
``` </pre>
--- ---
```python <pre>
{'Thu': 13, 'Sat': 2, 'Sun': 9} {'Thu': 13, 'Sat': 2, 'Sun': 9}
``` </pre>
--- ---
```python <pre>
{'Fri': 20, 'Thu': 13, 'Sat': 2, 'Sun': 9} {'Fri': 20, 'Thu': 13, 'Sat': 2, 'Sun': 9}
``` </pre>
## --video-solution-- ## --video-solution--

View File

@ -18,19 +18,19 @@ x = fruit[1]
## --answers-- ## --answers--
banana <pre>banana</pre>
--- ---
a <pre>a</pre>
--- ---
b <pre>b</pre>
--- ---
True <pre>True</pre>
## --video-solution-- ## --video-solution--

View File

@ -13,23 +13,23 @@ What is used to indicate a new line in a string?
## --answers-- ## --answers--
\\n <pre>\\n</pre>
--- ---
{new_line} <pre>{new_line}</pre>
--- ---
{n} <pre>{n}</pre>
--- ---
/n <pre>/n</pre>
--- ---
/new <pre>/new</pre>
## --video-solution-- ## --video-solution--

View File

@ -20,19 +20,19 @@ print(lst)
## --answers-- ## --answers--
['csev@umich.edu', 'cwen@iupui.edu'] <pre>['csev@umich.edu', 'cwen@iupui.edu']</pre>
--- ---
['csev@umich.edu'] <pre>['csev@umich.edu']</pre>
--- ---
['umich.edu', 'iupui.edu'] <pre>['umich.edu', 'iupui.edu']</pre>
--- ---
['csev@', 'cwen@'] <pre>['csev@', 'cwen@']</pre>
## --video-solution-- ## --video-solution--

View File

@ -13,19 +13,19 @@ What will search for a "$" in a regular expression?
## --answers-- ## --answers--
$ <pre>$</pre>
--- ---
\\dollar\\ <pre>\\dollar\\</pre>
--- ---
\\$ <pre>\\$</pre>
--- ---
!$ <pre>!$</pre>
## --video-solution-- ## --video-solution--

View File

@ -13,23 +13,23 @@ Which regex matches only a white space character?
## --answers-- ## --answers--
\\S <pre>\\S</pre>
--- ---
\\s <pre>\\s</pre>
--- ---
. <pre>.</pre>
--- ---
\_ <pre>\_</pre>
--- ---
\\. <pre>\\.</pre>
## --video-solution-- ## --video-solution--

View File

@ -26,19 +26,19 @@ n = parts[1]
## --answers-- ## --answers--
mail <pre>mail</pre>
--- ---
q <pre>q</pre>
--- ---
lar <pre>lar</pre>
--- ---
`lar@freecodecamp.org` <pre>lar@freecodecamp.org</pre>
## --video-solution-- ## --video-solution--

View File

@ -13,19 +13,19 @@ What is the symbol used in an assignment statement?
## --answers-- ## --answers--
~ <pre>~</pre>
--- ---
& <pre>&</pre>
--- ---
= <pre>=</pre>
--- ---
\| <pre>\|</pre>
## --video-solution-- ## --video-solution--

View File

@ -31,23 +31,23 @@ print(info[1]['name'])
## --answers-- ## --answers--
Quincy <pre>Quincy</pre>
--- ---
Mrugesh <pre>Mrugesh</pre>
--- ---
001 <pre>001</pre>
--- ---
009 <pre>009</pre>
--- ---
[Error] <pre>[Error]</pre>
## --video-solution-- ## --video-solution--