skyreal
V2EX  ›  问与答

python 初学加法问题

  •  
  •   skyreal · Sep 17, 2015 · 2412 views
    This topic created in 3896 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   ·   1403 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 17:12 · PVG 01:12 · LAX 10:12 · JFK 13:12
    ♥ Do have faith in what you're doing.