Python 9

#输入:
print(help(input))
'''
input(prompt=None, /)
    Read a string from standard input.  The trailing newline is stripped.
    
    The prompt string, if given, is printed to standard output without a
    trailing newline before reading input.
    
    If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.
    On *nix systems, readline is used if available.
None
'''
name = input('请输入name:')    #阻塞时
print(name)

#   input(promat=None)----->标准输入流(键盘)
#   input() 阻塞          类似管道(Linux中的|)
#   admin   回车结束阻塞状态----->将流中的内容输出----->赋值给name

'''
练习:
游戏:捕鱼达人

输入参与游戏者的用户名:
输入密码:

充值:500元
'''

print('''
        ***********************
                捕鱼达人
        ***********************
''')
username = input('请输入username:')
password = input('请输入你的password:')
print('{}请充值才能加入游戏!'.format(username))
coins = input('请充值:')
# input()   输入的都是str,即使输入的是500,也会添加引号'500'
coins = int(coins)        #强转为int
print('{}充值成功!当前游戏币是:{}'.format(username,coins))
'''

        ***********************
                捕鱼达人
        ***********************

请输入username:小张
请输入你的password:python
小张请充值才能加入游戏!
请充值:500
小张充值成功!当前游戏币是:500
'''
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值