1. Boolean Values
Meaning: Represents true or false in judgments, generally used in conditional tests.
a = True
print(a)
print(10 < 5)
print(10 > 8)
# output
True
False
True
Original...About 1 min
AWAKE AND AWARE
Meaning: Represents true or false in judgments, generally used in conditional tests.
a = True
print(a)
print(10 < 5)
print(10 > 8)
# output
True
False
True
tup = (2, "x", "y")
print(tup, type(tup))
# output
(2, 'x', 'y') <class 'tuple'>
Suppose we have the following contacts:
Name | Phone Number |
---|---|
李雷 | 123456 |
韩梅梅 | 132456 |
大卫 | 154389 |
Mr.Liu | 131452 |
Bornforthis | 180595 |
Alexa | 131559 |
set1 = {1, 2, 3, 4, 5}
.py
files named according to the following pattern:
hw1_q1.py
, hw1_q2.py
, etc.In [2]: 1+1
Out[2]: 2
In [3]: 1+1.0
Out[3]: 2.0
In [4]: 9-1
Out[4]: 8
In [5]: 9-1.0
Out[5]: 8.0
In [6]: 2*2
Out[6]: 4
In [7]: 2*2.0
Out[7]: 4.0
In [8]: 9/3
Out[8]: 3.0
In [9]: # If one of the numbers is float, the result will be float (highest priority)
In [10]: # Division involves precision issues, so the result is a float
A string is a sequence composed of letters, numbers, and special characters.
— Using single quotes, double quotes, or triple quotes.