[Tutor] string integers?

Brian van den Broek brian.van.den.broek at gmail.com
Sun Feb 12 23:44:47 CET 2012


On 12 February 2012 21:27, William Stewart <williamjstewart at rogers.com> wrote:
>
> thanks i tried the code and it doesnt make anydiffference what I need is it to multiply now I fixed the error message but how do I get the 2 numbers that the person enters to multiply
>
> --- On Sun, 2/12/12, Brian van den Broek <brian.van.den.broek at gmail.com> wrote:
>
>
> From: Brian van den Broek <brian.van.den.broek at gmail.com>
> Subject: Re: [Tutor] string integers?
> To: "William Stewart" <williamjstewart at rogers.com>
> Cc: tutor at python.org
> Date: Sunday, February 12, 2012, 8:53 AM
>
>
>
> 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


Hi William and list,

To the list:

I have only recently reappeared here on the Tutor list, but years
back, I learned a great deal from various patient people, some of whom
are still here. (Grateful waves to those folk!) I feel fairly
confident that the message below is still in the spirit and cultural
norms of the list. However, if I am wrong in that, I would welcome any
Tutor veterans calling me out, in public (preferred) or in private.

To William:

I have a few observations that, if you take them to heart, will help
you make better use of the Tutor mailing list. They may seem picky,
but I assure you that there are reasons behind each thing I say and
following these observations will give you a much more rewarding
experience with the list.

1) Please don't top post. It bothers geeks and as you want geeks to
help you, even if that preference seems silly (it isn't), grit your
teeth and do as those who you are asking to help you would prefer.
('Geek' is, of course, a term of praise.)

2) Please be sure to hit Reply-to-All in your mail client. If it lacks
such a button, be sure to add a to:tutor at python.org. If you don't your
response will go only to the person to whom you are replying. This is
what happened to your response to me. If I'd lost the time, interest,
or ability to reply to you, your message to me would never get you any
further help. Sent to both me and to the list, you can get help from
others even if help from me is not forthcoming for whatever reason.

3) Please put more effort in to asking your question in a clear
manner. In all honesty, I have no idea what it is you hope "thanks i
tried the code and it doesnt make anydiffference what I need is it to
multiply now I fixed the error message but how do I get the 2 numbers
that the person enters to multiply" to produce by way of further help.
What code? What difference were you expecting? Different from what?
What error message? I am quite sure I spent longer typing up my first
message to you than you did typing your reply. You will generally find
that people here will respond positively to effort you expend to make
your question clear as it makes it easy for them to help you. If you
are not willing to spend much effort, in general, people are not
likely to spend more effort than you are.

To help see the importance of including your code, your output or
backtrace, and a clear statement of your expectations and intentions,
consider what happened with your first message. I said "It is a bit
unclear what you mean by "it wont let me write int2"." I noticed a
problem with your code and, as you'd not been clear about what problem
you were having, I said something about that. I didn't read carefully
enough to see the problems that others pointed out to you. (If you
didn't care to clearly state your problem, I didn't care to work it
out for you.) While your code did have multiple issues (that's fine;
we were all beginners once), the way you asked it made it hard for me
to focus on the issue you were having at the time.

Another benefit of taking the time to compose a clear email with a
clear statement of your problem (including a *copy and paste* of the
smallest chunk of code that exhibits the problem, a description of the
expected output, and a *copy and paste* of the output or generate
traceback) is that very often, the process of generating such a
message will help you solve your own problem. I cannot begin to guess
how many times I've started writing a question to this or some other
technical mailinglist or newsgroup only to find that the process of
asking well forced me to think clearly enough that I came to the
solution myself.

I have hit you with a lot, and if you feel a bit scolded, well, that
was part of my intent. It is, however, intended as a friendly
scolding. If you take it to heart, I will have helped you MUCH more
than I would have had I spent hours answering the kinds of questions
that you have been posting. I can tell you that if you don't seem to
have tried to take any of this to heart, I won't be spending more time
in an effort to help you. I suspect that I am not alone in this view
amongst those who read this list.

This also helps explain the apparent contradiction: I have spent a lot
of time and effort to explain to you that in general, people won't
spend more time and effort on your problem than you will. While it
might not seem to you on first reading this email, you have just
received a gift---the gift of someone taking the time to help explain
how to benefit from the community here even though your efforts in our
exchange above have not been promising. (Much of what I have said is
on the list website or in the list welcome message and thus is
something about which you ought already to have read.) Rather than
letting your message go without an answer, I picked it as one of those
cases where I'd try to give the sort of gift I have myself been given
by others in the past. You will not very often find someone willing to
put so much effort into answering a question that exhibits as little
effort as did yours.

As for your actual programming problem, I suspect I see what is going
on, but I don't want to play another round of guessing games. I
suggest that you start a new thread with a question written in light
of my remarks above. I am confident that if you do, you will find
plenty of friendly help on this list.

Best,

Brian vdB

PS Reviewing this email and the upthread posts, I see that you
received much of this advice in other replies. Did you read those
other replies? The message you sent to me "thanks i tried the code and
it doesnt make anydiffference what I need is it to multiply now I
fixed the error message but how do I get the 2 numbers that the person
enters to multiply" betrays *absolutely no effort whatsoever* to
follow the given advice. You will, I think, soon find your prospects
of help here are dim if you ignore the advice about how to seek help
that you do get.


More information about the Tutor mailing list