[Tutor] string integers?

Brian van den Broek brian.van.den.broek at gmail.com
Sun Feb 12 14:53:22 CET 2012


On 12 Feb 2012 15:28, "William Stewart" <williamjstewart at rogers.com> wrote:
>
> I am trying to get 2 string variables and 2 integer variables to be able
to be multiplied
> can anyone tell me what I did wrong
>
> str1 = raw_input("Type in a String: ")
> str2 = raw_input("Type in a String: ")
> int1 = raw_input("Type in a integer variable: ")
> int2 = raw_input("Type in a integer variable: ")
> print str1 + str2 + int1 + int2
> import math
> print str1, "*", str2, "*", int1, "*"int2  "=", str1, * str2, * int1 *
int 2
>
>
>
> and it wont let me write int2
> I know this may look stupid to most people  but I am just new at this so
dont laugh  :)
>

Hi,

It is a bit unclear what you mean by "it wont let me write int2".

Try running this function and see if it helps:

def test():
    data = raw_input("give me an integer")
    print type(data)
    print "a string" * "another"

Best,

Brian vdB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120212/7e52bf00/attachment.html>


More information about the Tutor mailing list