#7-1
print
(
'what kind of car do you want?'
)
car
=
input
()
print
(
'let me see if i can find you a
%s
'
%
car)
#7-2
number
=
input
(
'how many people ?'
)
if
int
(number)
>
8
:
print
(
'we are out of table!'
)
else
:
print
(
'ok!'
)
#7-3
number
=
int
(
input
(
'give me a number!'
))
if
number
%
10
==
0
:
print
(
'True'
)
else
:
print
(
'False'
)
#7-4
print
(
'给我们些披萨配料!'
)
s
=
input
()
while
s
!=
'quit'
:
print
(
'we will add
%s
to it'
%
s)
s
=
input
()
#7-5
age
=
int
(
input
(
'your age?'
))
while
True
:
if
age
>=
3
and
age
<=
12
:
print
(
'10 dollar'
)
elif
age
<
3
:
print
(
'free'
)
else
:
print
(
'15 dollar'
)
age
=
int
(
input
(
'your age?'
))
#7-6
s
=
input
(
'给我们些披萨配料!'
)
while
s
!=
'quit'
:
print
(
'we will add
%s
to it'
%
s)
s
=
input
()
while
True
:
s
=
input
(
'给我们些披萨配料!'
)
if
s
==
'quit'
:
break
else
:
print
(
'we will add
%s
to it'
%
s)
active
=
True
while
active :
s
=
input
(
'给我们些披萨配料!'
)
if
s
==
'quit'
:
active
=
False
else
:
print
(
'we will add
%s
to it'
%
s)
#7-7
while
True
:
print
(
1
)
#7-8
sandwich_orders
=
[
'奶酪三明治'
,
'海鲜三明治'
,
'火腿三明治'
]
finished_sandwiches
=
[]
while
sandwich_orders :
s
=
sandwich_orders.pop()
print
(
'
%s
have finished'
%
s)
finished_sandwiches.append(s)
#7-9
sandwich_orders
=
[
'奶酪三明治'
,
'海鲜三明治'
,
'火腿三明治'
,
'pastrami'
,
'pastrami'
,
'pastrami'
]
print
(
'we are out of pastrami'
)
while
'pastrami'
in
sandwich_orders:
sandwich_orders.remove(
'pastrami'
)
#7-10
place
=
input
(
'If you could visit one place in the world, where would you go?'
)
print
(
'pass quit to quit'
)
answer
=
{}
while
place
!=
'quit'
:
-
if
place
in
answer.keys():
answer[place]
+=
1
else
:
answer[place]
=
0
place
=
input
(
'If you could visit one place in the world, where would you go?'
)
for
i,v
in
answer.items():
print
(
'place: '
,i,
'number: '
,v)