#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    2
    Rep Power
    0

    Question Need help with outdated Python!


    I want this to be displayed:

    30 x 5000000 = 15000000000

    I have variables "num1", "num2", and "answer".

    num1 = 30
    num2 = 5000000
    answer = num1 * num2


    How do I print it into the string?


    What I think to do:

    num1 = 30
    num2 = 5000000
    answer = num1 * num2
    print "&i x &i = &i"(num1, num2, answer)


    But that doesn't work.

    [Note: I am using Python 2.6.]
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2010
    Posts
    26
    Rep Power
    0
    you try this yet?



    python 2:
    print "%d X %d = %d" %(num1, num2, num1*num2)

    i think that is right...
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    2
    Rep Power
    0

    Thumbs up Thanks!


    Originally Posted by dogdaynoon
    you try this yet?



    python 2:
    print "%d X %d = %d" %(num1, num2, num1*num2)

    i think that is right...
    Thanks. I couldn't find that anywhere else.

IMN logo majestic logo threadwatch logo seochat tools logo