
SunFounder Thales Kit for Raspberry Pi Pico, Release 1.0
numbers
=
[
1
,
2
,
3
,
4
]
sum
=
0
for
val
in
numbers:
sum
=
sum
+
val
(
"The sum is"
,
sum
)
>>> %Run -c $EDITOR_CONTENT
The sum is 10
The break Statement
With the break statement we can stop the loop before it has looped through all the items:
numbers
=
[
1
,
2
,
3
,
4
]
sum
=
0
for
val
in
numbers:
sum
=
sum
+
val
if
sum
==
6
:
break
(
"The sum is"
,
sum
)
>>> %Run -c $EDITOR_CONTENT
The sum is 6
3.5. MicroPython Basic Syntax
119
Содержание Thales Kit
Страница 1: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 Jimmy SunFounder Jun 04 2021 ...
Страница 2: ......
Страница 4: ...ii ...
Страница 6: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 2 CONTENTS ...
Страница 10: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 6 Chapter 1 Introduction to Raspberry Pi Pico ...
Страница 12: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 8 Chapter 2 What is Included in This Kit ...
Страница 13: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 2 1 Components List 2 1 Components List 9 ...
Страница 42: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 38 Chapter 2 What is Included in This Kit ...
Страница 140: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 136 Chapter 3 For MicroPython User ...
Страница 164: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 160 Chapter 4 For Arduino User ...