View difference between Paste ID: r8H426d7 and Su76i9C1
SHOW: | | - or go back to the newest paste.
1
Analyse the micropython code below:
2
3
message = 'ALARM'
4-
signal_strengths = [-35, -30, -33, -40, -29, -31, -34, -32]
4+
for letter in message:
5-
sum_signal_strengths = sum(signal_strengths)
5+
  display.scroll(letter)
6
7-
print('Sum:',str(sum_signal_strengths)
7+
signal_strengths = [-50,-49,-52,-48]
8
for val in signal_strengths:
9
  display.scroll(str(val)) 
10
11
mining_log = {'TR1': 198, 'TR2': 209}
12
for key in mining_log:
13
  display.scroll(key) 
14-
  <grok-condition type="element-condition-completed" selector="#mc1"></grok-condition>
14+
15
Students will be examined on the micropython code with a quiz which is represented in this format, your task will be to create a quiz in the exact same format on differnt code
16-
what gets printed when this code runs?<br>
16+
17-
`signal_strengths = [5, 5, 8, 9, 11]<br>
17+
18-
sum_signal_strengths = sum(signal_strengths)<br>
18+
19-
print(sum_signal_strengths)
19+
  <grok-condition type="element-condition-completed" selector="#mc3"></grok-condition>
20-
`
20+
21
What will be printed after running the following code?<br>
22-
 <grok-option-group id="mc1">
22+
`for letter in message:`<br>
23
`|  print(letter)`
24
  
25
where `message = 'ALARM'`
26
27
 <grok-option-group id="mc3">
28
   
29
   <grok-option tip="Incorrect try again!"> 
30
31
ALARMLMRA
32
    
33-
38
33+
34
  
35
   
36
  <grok-option correct tip="Correct!"> 
37
38
A<br>
39-
11
39+
L<br>
40
A<br>
41
R<br>
42
M
43
 
44
  </grok-option>
45-
35
45+
46
   <grok-option tip="Incorrect try again!"> 
47
48
ALARM
49
    
50
  </grok-option>
51
   
52
  <grok-option tip="Incorrect try again!"> 
53
54
RMLA
55
    
56
  </grok-option>
57-
  <grok-condition type="element-condition-completed" selector="#mc2"></grok-condition>
57+
58
  
59-
what gets printed when this code runs?<br>
59+
60-
`signal_strengths = [5, 15, 8, 9, 11]<br>
60+
61-
sum_signal_strengths = sum(signal_strengths)<br>
61+
62-
print(sum_signal_strengths)`
62+
63
<grok-step>
64-
 <grok-option-group id="mc2">
64+
  <grok-condition type="element-condition-completed" selector="#mc4"></grok-condition>
65
66
How many times will the loop run in the following code?<br>
67
`for val in signal_strengths:`<br>
68-
38
68+
`|  print(str(val))`
69
  
70
where `signal_strengths = [-50,-49,-52,-48]`
71
72
 <grok-option-group id="mc4">
73
   
74
   <grok-option tip="Incorrect try again!"> 
75-
29
75+
76
2
77
    
78
  </grok-option>
79
  
80
   
81-
33
81+
82
83
4
84
 
85
  </grok-option>
86-
   <grok-option correct tip="Correct!"> 
86+
87
   <grok-option tip="Incorrect try again!"> 
88-
48
88+
89
5
90
    
91
  </grok-option>
92
   
93
  <grok-option tip="Incorrect try again!"> 
94
95
3
96
    
97
  </grok-option>
98
   
99
  
100
  </grok-option-group>
101
102
</grok-step>
103
104
<grok-step>
105
  <grok-condition type="element-condition-completed" selector="#mc5"></grok-condition>
106
107
What will be printed after running the following code?<br>
108
`for key in mining_log:`<br>
109
`|  print(key)`
110
  
111
where `mining_log = {'TR1': 198, 'TR2': 209}`
112
113
 <grok-option-group id="mc5">
114
   
115
   <grok-option tip="Incorrect try again!"> 
116
117
TR1: 198, TR2: 209
118
    
119
  </grok-option>
120
  
121
   
122
  <grok-option correct tip="Correct!"> 
123
124
TR1<br>
125
TR2
126
 
127
  </grok-option>
128
   
129
   <grok-option tip="Incorrect try again!"> 
130
131
198, 209
132
    
133
  </grok-option>
134
   
135
  <grok-option tip="Incorrect try again!"> 
136
137
{'TR1': 198, 'TR2': 209}
138
    
139
  </grok-option>
140
   
141
   <grok-option tip="Incorrect try again!"> 
142
143
'TR1' 198, 'TR2' 209
144
    
145
  </grok-option>
146
   
147
  </grok-option-group>
148
149
   
150
</grok-step>
151
 
152
 
153
<grok-if show>
154
<grok-condition type="element-condition-completed" selector="#mc7"></grok-condition>
155
 
156
**Congratulations!**
157
 
158
</grok-if>
159
160
161
Can you generate a quiz for this code:
162
163
164
165
Please respond in a code block and imitate the exact formatting and spacing of the quiz questions. Before asking the question quote a minimum amount of necessary code for the question
166