第五章 课后习题

#创建一个你最喜欢的歌手的列表
my_favorite_singers = ["周杰伦","邓紫棋"]
print(my_favorite_singers)


#创建一个由元组构成的列表,每个元组包含城市的经纬度。
location =[ ]
上海 = (121.43,31.23)
北京 = (116.40,39.30)
location.append(上海)
location.append(北京)
print(location)


#创建一个包含你不同属性的字典;身高、最喜欢的颜色、和最喜欢的作者
my_property = dict(height=280,my_favorite_colour='blue',my_favorite_author="莫言")
print(my_property)


#编写一个程序,让用户访问你的属性,并返回上一个创建的字典
n = input("type my property:")
if n in my_property:
          x = my_property[n]
          print(x)
else:
    print("not found")
           
          

                       
原文地址:https://www.cnblogs.com/yijierui/p/12823526.html