SunFounder Thales Kit for Raspberry Pi Pico, Release 1.0
a
=
float
(
20.5
)
b
=
list
((
"apple"
,
"banana"
,
"cherry"
))
c
=
bool
(
5
)
(a)
(b)
(c)
>>> %Run -c $EDITOR_CONTENT
20.5
['apple', 'banana', 'cherry']
True
>>>
Type Conversion
You can convert from one type to another with the int(), float(), and complex() methods: Casting in python is therefore
done using constructor functions:
• int() - constructs an integer number from an integer literal, a float literal (by removing all decimals), or a string
literal (providing the string represents a whole number)
• float() - constructs a float number from an integer literal, a float literal or a string literal (providing the string
represents a float or an integer)
• str() - constructs a string from a wide variety of data types, including strings, integer literals and float literals
a
=
float
(
"5"
)
b
=
int
(
3.7
)
c
=
str
(
6.0
)
(a)
(b)
(c)
Note: You cannot convert complex numbers into another number type.
3.5.10 Operators
Operators are used to perform operations on variables and values.
•
•
•
•
•
•
•
128
Chapter 3. For MicroPython User
Содержание 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 ...