账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    python3怎么赋值?
    43
    0

    刚刚开始学python3,在atom里面写代码如下
    inp = input ('Enter Hours:')
    hours = float('inp')
    inp = input ('Enter Rate:')
    rate = float('inp')
    print ('rate')
    print ('hours')
    pay = Rate * Hours
    print ('pay')

    想要赋值给inp,可是inp被认为是string。运行出来的结果是
    Enter Hours:35
    Traceback (most recent call last):
    File "assign1.py", line 3, in <module>

    hours = float('inp')

    ValueError: could not convert string to float: 'inp'
    问题在哪里呢?
    十分感谢!

    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 冉是非 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部