您的位置:首页 > 其它

homework5

2018-03-19 21:52 176 查看

5-3

(1)

alien_color = 'green'
if alien_color == 'green':
print('You got 5 points')
else:
print('')


(2)

alien_color = 'red'
if alien_color == 'green':
print('You got 5 points')
else:
print('')


5-7

favorite_fruits = ['apple', 'orange', 'peach']
if 'apple' in favorite_fruits:
print('You really like apple!')
if 'orange' in favorite_fruits:
print('You really like orange!')
if 'peach' in favorite_fruits:
print('You really like peach!')
if 'bananas' in favorite_fruits:
print('You really like bananas!')
if 'grape' in favorite_fruits:
print('You really like grape!')


5-8

users = ['mike', 'jace', 'admin', 'nancy', 'dave']
for user in users:
if user == 'admin':
print('Hello admin, would you like to see a status report?')
else:
print('Hello ' + user + ', thank you for logging in again')


5-9

users = ['mike', 'jace', 'admin', 'nancy', 'dave']
for user in users:
if user == 'admin':
print('Hello admin, would you like to see a status report?')
else:
print('Hello ' + user + ', thank you for logging in again')
if not users:
print('We need to find some users!')
users = []
if not users:
print('We need to find some users!')
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  homework