V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
skyreal
V2EX  ›  问与答

python 初学加法问题

  •  
  •   skyreal · Sep 17, 2015 · 2378 views
    This topic created in 3883 days ago, the information mentioned may be changed or developed.
    # -*- coding:utf-8 -*-
    from sys import argv
    script, aa, bb = argv
    aa = raw_input ('你有多少只鸡:')
    bb = raw_input ('你有多少只鸭:')
    print "你一共有鸡鸭:", aa+bb

    输入鸡1鸭2,输出12

    不应该是3嘛?
    2 replies    2015-09-17 16:08:18 +08:00
    tonghuashuai
        1
    tonghuashuai  
       Sep 17, 2015   ❤️ 1
    print "你一共有鸡鸭:", int (aa )+int (bb )
    skyreal
        2
    skyreal  
    OP
       Sep 17, 2015
    谢谢!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5882 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 46ms · UTC 02:00 · PVG 10:00 · LAX 19:00 · JFK 22:00
    ♥ Do have faith in what you're doing.