fix: more conditional structures python (#38981)
This commit is contained in:
@ -8,6 +8,7 @@ videoId: HdL82tAZR20
|
|||||||
---
|
---
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
<section id='description'>
|
<section id='description'>
|
||||||
More resources:
|
More resources:
|
||||||
- <a href="https://www.youtube.com/watch?v=crLerB4ZxMI" target='_blank'>Exercise 1</a>
|
- <a href="https://www.youtube.com/watch?v=crLerB4ZxMI" target='_blank'>Exercise 1</a>
|
||||||
@ -15,36 +16,34 @@ More resources:
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
|
|
||||||
<section id='tests'>
|
<section id='tests'>
|
||||||
|
|
||||||
```yml
|
````yml
|
||||||
question:
|
question:
|
||||||
text: |
|
text: |
|
||||||
Given the following code:
|
Given the following code:
|
||||||
```python
|
```python
|
||||||
temp = "5 degrees"
|
temp = "5 degrees"
|
||||||
cel = 0
|
cel = 0
|
||||||
try:
|
|
||||||
fahr = float(temp)
|
fahr = float(temp)
|
||||||
cel = (fahr - 32.0) * 5.0 / 9.0
|
cel = (fahr - 32.0) * 5.0 / 9.0
|
||||||
except:
|
|
||||||
print("temp should be a number")
|
|
||||||
print(cel)
|
print(cel)
|
||||||
```
|
```
|
||||||
Which line would cause the script to immediately stop because of an error?
|
Which line/lines should be surrounded by `try` block?
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- |
|
- |
|
||||||
1
|
1
|
||||||
|
- |
|
||||||
|
3
|
||||||
|
- |
|
||||||
|
3,4
|
||||||
- |
|
- |
|
||||||
4
|
4
|
||||||
- |
|
|
||||||
6
|
|
||||||
- |
|
|
||||||
7
|
|
||||||
- |
|
- |
|
||||||
None
|
None
|
||||||
solution: 2
|
solution: 3
|
||||||
```
|
````
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
Reference in New Issue
Block a user