Newbie - Trying to Help a Friend

M

MRAB

I for one *have* done extensive research on the Nazis, not to a
professional academic standard, but certainly to the point where I like
to flatter myself that I know a thing or two about them, their political
philosophy, and their actions. I must say that your analogy "multiple
postings to a newsgroup implies Nazi" perplexes me too.
[snip]

The Nazis were known for many bad things, but multiple postings wasn't
one of them. (Nor spam, now I think about it...)
 
T

Tim Golden

I fully support the right of everyone to make cryptic references to
movies, television shows, science fiction and fantasy novels, internet
memes, and assorted pop culture references.

One of the (occasionally humbling) effects of internet communication is
the realisation that the pop-culture reference you assumed would be
instantly shared and understood by *any normal person anywhere* is, in
fact, confined to your own back yard.

You may or may not have caught sight of the BBC's recent blanket
marketing of the upcoming 50th anniversary of Dr Who, a somewhat iconic
British TV series. I was genuinely perplexed when US-based websites
started running articles like "What the *** is this Dr Who all about?"
and "All you need to know about Dr Who: a Guide for the Unknowing".

Here in Britain, even if you've never watched and/or hate the thing, you
can't help at least knowing *something* about Dr Who. At least the
basics: Doctor, TARDIS, Daleks; that sort of thing.

In reverse, I'm sometimes bemused by (often, but not always) references
to things which apparently sit centrally in the American pop-culture
psyche but which are unknown over here, or at least simply known *about*.

It's not usually a problem -- it's always fun to gain a bit of an
insight into some other culture. Just occasionally, though, someone
says, eg, "You keep using that word; I don't think it means what you
think it means", intending it as a humorous reference to "The Princess
Bride". But if you have (as I strongly suspect 99% of the world's
population has) no knowledge of that film, or at least of its
catchphrases, then it can come across instead as a slightly blunt
admonition of someone else's ignorance.

(Of course, if some were to say "My name is Inigo Montoya; you killed my
father; prepare to die" without any further comment then you'd either
have to assume that they were making a reference to a film or book
unknown to you or that someone going by that alias genuinely believed
you were responsible and had tracked you down across the internet to
confront you finally on comp.lang.python. Who knows?)

TJG
 
C

Chris Angelico

Of course, if some were to say "My name is Inigo Montoya; you killed my
father; prepare to die"...

You killfiled my address - prepare to be ignored!

ChrisA
 
A

Antoon Pardon

Op 20-11-13 19:09, Mark Lawrence schreef:
I suggest that you write to the BBC and get all episodes of the
extremely popular *COMEDY* "Dad's Army" withdrawn as "typical shabby
Nazi trick" was one of Captain Mainwearing's main lines.

Honestly? You expect people to recognize a main line from an old
television series?
And if I want
to overreact, I'll overreact, as I couldn't care two hoots whether I'm
dealing with an arsehole from the Python Software Foundation or one
who's not.

Now you sound just like Nikos.
 
A

Anssi Saari

Dennis Lee Bieber said:
Does Pan have an option to generate its own Message-ID header?

Headers seem to indicate multiple injections somewhere

Perhaps Pan doesn't? Someone else had multipostings in the Android group
but he was posting via aioe.
 
C

Chris Angelico

Op 20-11-13 19:09, Mark Lawrence schreef:

Honestly? You expect people to recognize a main line from an old
television series?

Well, a good British comedy does go around a long way. I have to say,
though, the shortness of the line makes it harder to recognize. Only
in the tightest of circles could one say "Bother that telephone!" and
have people understand that it's a reference to the Fat Controller
from The Railway Series (aka the Thomas the Tank Engine books). The
more quote you make, the more likely that pieces of it will be
recognized.

But as I said, all it takes is a little footnote, or something like
"... typical shabby Nazi trick, as Capt Mainwearing would say", to
make it clear. Most (all?) of us would understand that as a
joke/reference and as not offensive.

ChrisA
 
N

Neil Cerutti

Well, a good British comedy does go around a long way. I have to say,
though, the shortness of the line makes it harder to recognize. Only
in the tightest of circles could one say "Bother that telephone!" and
have people understand that it's a reference to the Fat Controller
from The Railway Series (aka the Thomas the Tank Engine books). The
more quote you make, the more likely that pieces of it will be
recognized.

The best sort of reference is one you can miss completely and
still not be confused by. For example, The Borribles by De
Larrabeiti is one of my favorite books despite my knowing virtually
nothing of the back-streets of London or the (now dated) pop-culture
satire it contained.

Many of the main villains in
the book are hilarious and mean-spirited parodies of
a series of British children's literature, The Wombles,
and a British TV show, Steptoe and Son, but the characters work
fine on their own.

But even so, I agree that a footnote is a good idea. And I haven't always
lived up to that ideal, myself.
 
C

Chris Angelico

Many of the main villains in
the book are hilarious and mean-spirited parodies of
a series of British children's literature, The Wombles,
and a British TV show, Steptoe and Son, but the characters work
fine on their own.

Yeah, that's definitely the best way to do it. You don't need to know
The Beauty Stone to understand that Colinette, in the city of
Lenalede, is trying to get herself appointed as Lord Chief Justice on
the grounds that (she claims) the current incumbent is unfair in his
rulings. But if you _do_ know that obscure 19th century opera, you'll
know there's a line in it "And Colinette from Lenalede, who counts
herself the fairest there". (The opera has absolutely nothing to do
with justice, incidentally. Colinette is entering herself in a beauty
contest. Quite a different meaning of "fairest".)

ChrisA
 
B

bradleybooth12345

Coming back to the second question

"The collatz process is as follows. Take a positive integer n greater than 1. while n is greater than 1 repeat the following; if N is even halve it and if N is odd multiply it by 3 and add 1. The (Unsolved) collatz conjectureis that this process always terminates.

The user should be prompted to supply the number n, and your program shouldbuild the list of values taken by sucessive iteration of the algorithm, and print it out. For example, if 7 is input your program should print the list

[7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1]

We've managed to come up with this, but obviously it's wrong. Any Idea's?

def collatz_sequence (n) :
seq = [ ]
if n < 1 :
return [ ]
while n > 1:
if n % 2 == 0:
n = n/2
else:
n = 3*n+ 1
seq.append (n)
return seq
 
G

Gary Herron

Coming back to the second question

"The collatz process is as follows. Take a positive integer n greater than 1. while n is greater than 1 repeat the following; if N is even halve it and if N is odd multiply it by 3 and add 1. The (Unsolved) collatz conjecture is that this process always terminates.

The user should be prompted to supply the number n, and your program should build the list of values taken by sucessive iteration of the algorithm, and print it out. For example, if 7 is input your program should print the list

[7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1]

We've managed to come up with this, but obviously it's wrong. Any Idea's?

def collatz_sequence (n) :
seq = [ ]
if n < 1 :
return [ ]
while n > 1:
if n % 2 == 0:
n = n/2
else:
n = 3*n+ 1
seq.append (n)
return seq

Why do you say it's wrong? What does it do? What was expected?

I see that your indentations don't match, but I can't tell if that's
your error or an email problem. Is that the 'obviously wrong' part?

I also see that you create an (apparently correct) function, which
returns a nice result. But you haven't called the function to actually
run it with a specific value to be printed out. Perhaps that's the
'obviously wrong' part you refer to.

However, the function itself looks correct otherwise, although you may
want to start the sequence off with [n] rather than [] so as to match
the suggested output.

Gary Herron
 
B

bradleybooth12345

the problem i have is that it's just giving me the first number of the sequence not the actual sequence
 
T

Terry Reedy

Coming back to the second question

"The collatz process is as follows. Take a positive integer n greater than 1. while n is greater than 1 repeat the following; if N is even halve it and if N is odd multiply it by 3 and add 1. The (Unsolved) collatz conjecture is that this process always terminates.
The user should be prompted to supply the number n, and your program should build the list of values taken by sucessive iteration of the algorithm, and print it out. For example, if 7 is input your program should print the list

[7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1]

The specification does not say what the result should be when the input
is 1, but given the example above, [1] seems reasonable (rather than an
exception or []). [] is ok for 0 (or negative).
We've managed to come up with this, but obviously it's wrong.

In what way is it wrong? The answer to that tells you what to fix.
A syntax error about indentation? Fix the indentation.
Any Idea's?

Write test code before writing the function.

for inn,out in [(0, []), (1, [1]), (2, [2,1]),
(3, [3,10,5,16,8,4,2,1]),
(7, [7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1]), ]:
s = collatz(inn)
print(inn, ':', s)
if s != out:
print('is not', out)
def collatz_sequence (n) :
seq = [ ]

4 space indents are best; a good editor, like the one with Idle, will
convert said:
if n < 1 :
return [ ]
while n > 1:
if n % 2 == 0:

dedent if so it lines up with else below
n = n/2
else:
n = 3*n+ 1
seq.append (n)
return seq

does not line up with while

Once you get indents consistent, test failure should suggest the
remaining error.
 
T

Terry Reedy

the problem i have is that it's just giving me the first number of the sequence not the actual sequence

Please show actually copy/pasted input and output.
 
G

Gregory Ewing

Tim said:
One of the (occasionally humbling) effects of internet communication is
the realisation that the pop-culture reference you assumed would be
instantly shared and understood by *any normal person anywhere* is, in
fact, confined to your own back yard.

Obviously we need a mail/newsreader plugin that googles
for cultural references in the messages you're reading
and inserts helpful footnote links!
 
G

Gary Herron

the problem i have is that it's just giving me the first number of the sequence not the actual sequence

Not when I run it. After correcting the indentation errors, I get the
correct sequence *except* that it's missing the first number.

You are making it very hard to help you. Please show us the *whole*
session: the procedure (correctly indented please), the call of the
procedure, the print that outputs the result and the actual printed
result. Also provide an explanation of why the output is not what you
wanted.

Then perhaps we can get to the bottom of this.

Gary Herron
 
D

Denis McMahon

1) Find all the numbers less than n that are not divisible by a, b, or
c.
ask the user for x;
assign the value 0 to some other variable i;
while i is not greater than than x do the following [
if i is not divisible by a and i is not divisible by b and i is not
divisible by c then display i to the user;
add 1 to i;
]
The question didn't ask to find all the numbers, it asked to count how
many there are. ....

My post was intended as a demonstration of how you can convert a problem
into a sequence of steps that can then be programmed into a computer. Any
resemblance to the posted question may have been accidental.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top