Tipe Data di Python
Jason Myers
Instructor
TrueFalsePerhatikan huruf besar-kecilnya; ini bisa menyesatkan saat berpindah antara Python dan bahasa lain.
out_of_cookies = True
if out_of_cookies:
print("Run to the store NOW!")
Run to the store NOW!
apples=2
if apples:
print("We have apples.")
"We have apples."
apples=0
if apple:
print('We have apples.')
1"Cookies"["Cake", "Pie"]{"key": "value"}0""[]{}Nonecookie_qty == 3
== sama dengan!= tidak sama dengan< kurang dari<= kurang dari atau sama dengan> lebih dari>= lebih dari atau sama denganx = 0.1 + 1.1
x == 1.2
False
print(x)
1.2000000000000002
Hati-hati membandingkan kesetaraan float!
Tipe Data di Python