#!/user/bin/env python
# -*- coding:utf-8 -*-
# input() 可以让程序暂停工作
# int(input('please input something:'))
# % 取余运算
# 【标识符】
# prompt = "
Tell me something,and i will repeat it back to you:"
# message = ""
#
# active = True
# while active:
# message = input(prompt)
# if message == 'quit':
# active = False
# else:
# print(message)
# break 退出循环
# continue 终止当前循环(跳过本次)
# 无限循环 Ctrl + c 关闭显示窗口
"""
for循环中不应修改列表。否则将导致Python难以跟踪其中的元素,使用while循环进行修改。
"""
# 列表之间移动元素
unconfirmed_user = ['alice','brian','candace']
confirmed_users = []
while unconfirmed_user:
current_user = unconfirmed_user.pop()
print("Verifying user: " + current_user.title())
confirmed_users.append(current_user)
print("
The following users have been confired:")
for confirmed_user in confirmed_users:
print(confirmed_user.title())
# 删除 .pop() .remove()
# 使用用户输入来填充字典
responses = {}
polling_active = True
while polling_active:
name = input("your name:")
response = input("Do you like climb someday?")
responses[name] = response
repeat = input("Any others?(yes/no)")
if repeat == 'no':
polling_active = False
print("*"*50)
for name, response in responses.items():
print(name + "Do you like climb:" + response + "?")