homework + obfuscation ... this might work ...

S

Skip Montanaro

I have an idea. Take the threads where students ask the list to do
their homework for them (but don't have the cojones to admit that's
what they are doing), and merge them with the obfuscated Python idea.
A group of people could come up with the solution off-list, then
answer the poster's original question (no fair asking them to revise
their poorly specified requirements) with a very obfuscated answer
on-list. I think it would be interesting to be a fly on the wall when
they explain how their programs work to their professors, especially
if they have little easter eggs embedded in them.

:)

Perhaps we could start with the 10 random even numbers? I'll start:

#!/usr/bin/env python

import random

output = []

while len(output) < 10:
output.append(random.randrange(0, 1000, 2))

print 1, output

output = [random.randrange(0, 500) * 2 for _ in range(10)]

print 2, output

output = []

while len(output) < 10:
r = int(round(random.random() * 500))
if r % 2:
r *= 2
output.append(r)

print 3, output

getting-tired-of-homework-questions-in-my-old-age-ly, y'rs,

Skip
 

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,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top