checkme = True
checked = False
a == b
vocab.insert('another')
"", [], (), {}, …
[fun(w) for w in V if p(w)]
True
and 5 to False
. Try to use different comparison operators (not just ==
but also !=, >, …
print(f"1+1 == 2 {1+1 == 2}")
3
is in range(0,3)
.
3
?
Some problems adapted from PCC 5-6
person = (name, age)
[(name, age), (name, age), …]
sum()
and len()
to find the
average
čislo = ["jeden", "dva", "tři", "čtyři", "pět", "šest", "sedm", "osm", "devět", "deset"]
use if - elif - else
to construct the number plus 10
["jedenáct", "dvanáct", "třináct", "čtrnáct", "patnáct", "šestnáct", "sedmnáct", "osmnáct", "devatenáct", "dvacet"]
data = [
# Korean Onomatopoeia
[
("개굴개굴", "gaegul-gaegul", "Ribbit (frog sound)"),
("멍멍", "meong-meong", "Woof (dog barking)"),
("야옹", "ya-ong", "Meow (cat sound)"),
("딸랑딸랑", "ddal-lang-ddal-lang", "Jingle (bell sound)"),
],
# Chinese Onomatopoeia
[
("汪汪", "wāng wāng", "Woof (dog barking)"),
("喵喵", "miāo miāo", "Meow (cat sound)"),
("哗啦啦", "huā lā lā", "Splash (water flowing)"),
],
# Vietnamese Onomatopoeia
[
("meo meo", "", "Meow (cat sound)"),
("gâu gâu", "", "Woof (dog barking)"),
("ục ịch", "", "Splash (water or something heavy dropping in water)"),
("ro ro", "", "Purr (cat sound)"),
],
# Indonesian Onomatopoeia
[
("guk guk", "", "Woof (dog barking)"),
("meong", "", "Meow (cat sound)"),
("kring kring", "", "Ring (phone or bell sound)"),
],
# Japanese Onomatopoeia
[
("ワンワン", "wan wan", "Woof (dog barking)"),
("ニャーニャー", "nyaa nyaa", "Meow (cat sound)"),
("ピヨピヨ", "piyo piyo", "Tweet (bird chirping)"),
("ゴロゴロ", "goro goro", "Purring (cat purr) / Rolling"),
]
]
Some problems adapted from PCC 5-11.
True
or False
==, !=, >, <, element in list, …
if - elif - else
LAC: Language and the Computer Francis Bond.