skyreal
V2EX  ›  问与答

python 初学加法问题

  •  
  •   skyreal · Sep 17, 2015 · 2808 views
    This topic created in 4065 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
    tonghuashuai
    Sep 17, 2015❤️1
    1
    print "你一共有鸡鸭:", int (aa )+int (bb )
    skyreal
    skyreal
    OP
    Sep 17, 2015
    2
    谢谢!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4973 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 07:24 · PVG 15:24 · LAX 23:24 · JFK 02:24
    ♥ Do have faith in what you're doing.