Ene Uran 638 Posting Virtuoso

You are constructing a robot vehicle that has two tracks like a tank. Each track is driven by a DC motor that can go from full foreward (signal = 1.0) to slower foreward (eg. signal = 0.3) to rest (signal = 0.0) and slow reverse (eg. signal = -0.1) to full reverse (signal = -1.0). To turn, one track is moved slower than the other.

The control is done with a joy stick that has two variable outputs. One is the x-axis (full foreward 1.0 to full reverse -1.0) and y-axis (full left = 1.0 to full right -1.0). Write a Python program that interprets these outputs correctly so the two motors can receive the proper signal for variable speeds foreward, reverse, and left and right turns.

Ene Uran 638 Posting Virtuoso

Just like in C, a += b does the same thing as a = a + b, but the code produced is more efficient. So, I think, the roughly is there for the sticklers in life.

Ene Uran 638 Posting Virtuoso

There is of course an indent error in your code sample. I added some comments:

# move a line down and up the display window

import pygame

y = 0
dir = 1
running = True
width = 800
height = 600
screen = pygame.display.set_mode((width, height))
linecolor = 255, 0, 0  # red
#bgcolor = 0, 0, 0  # black
bgcolor = 255, 255, 255  # white

while running:
    event = pygame.event.poll()
    # quit when window corner x is clicked
    if event.type == pygame.QUIT:
        running = False
 
    screen.fill(bgcolor)
    pygame.draw.line(screen, linecolor, (0, y), (width-1, y))
 
    y += dir
    # reverse direction if line hits bottom or top
    if y == 0 or y == height-1:
        #dir *= -1
        dir = -dir
    # update display 
    pygame.display.flip()

width -1 simply draws the line short one notch of hitting the right edge of the display.

Ene Uran 638 Posting Virtuoso

I love the mocha latte ice cream from Safeway!
Right now I have my usual cheese danish with s hot mug of café au lait.

Ene Uran 638 Posting Virtuoso

I found a cute looking plane, so here is plane 30

Ene Uran 638 Posting Virtuoso

I love Thanksgiving turkey ... it's the only time in Los Angeles that you see natural breasts.
Quoted by Arnold Schwarzenegger

Ene Uran 638 Posting Virtuoso

Naw -- that won't let the Democrats stop them. Afterall, if dead people can vote then so can homeless people.

If you count brain dead people amongst the voters, you cover about 50% of them.

Ene Uran 638 Posting Virtuoso

Would the folks that say that it can't be done please get out of the way of folks that are doing it.

Ene Uran 638 Posting Virtuoso

Impressive!

Ene Uran 638 Posting Virtuoso

Leave it to M&M to come up with such a nice site!

Ene Uran 638 Posting Virtuoso

Very nice site!

Ene Uran 638 Posting Virtuoso

Cute game and good find!

Ene Uran 638 Posting Virtuoso

Oh no, this game messes with my head!

Ene Uran 638 Posting Virtuoso

If you can count your money, you don't have a billion dollars.
Quoted by Jean Paul Getty

Sideline:
IMHO, Heather Mills deserves every penny having to put up with a jerk like this for four years.

Ene Uran 638 Posting Virtuoso

The average McDonald's drive-through window makes a mistake in one third of the orders placed.

Ene Uran 638 Posting Virtuoso

The most secret area I have been in was in my younger brother's room. Officially called Area Detritus.

Ene Uran 638 Posting Virtuoso

Wasn't Iraq a British colony before it became ours? You can have it back!

Ene Uran 638 Posting Virtuoso

That red star looks cute, is it a Chinese plane?

Ene Uran 638 Posting Virtuoso

The poor and the jobless would most likely vote democratic anyway, unless they are looking forward to a job in the military.

For the people that lost their homes, I don't know if homeless people are allowed to vote? It would be tough to register without an address.

Ene Uran 638 Posting Virtuoso

Sad indeed ...

Ene Uran 638 Posting Virtuoso

it doesn't take too much to turn someone into a soldier. about a year of proper training is enough

It depends whom you are shooting at.

Ene Uran 638 Posting Virtuoso

Forgiveness is not an occasional act, it is a permanent attitude.
Quoted by Dr. Martin Luther King

Ene Uran 638 Posting Virtuoso

Well, I can't remember when the US was not in some kind of a war. Professional soldiers are so much better than draftees. Why draft someone that is not a soldier at heart?

Ene Uran 638 Posting Virtuoso

I beg to differ -- how many murders, rapists, and drug pushers would you expect to find in heaven ?

All the ones that eventually repented will be there. EnderX is the authority here, ask him.

Ene Uran 638 Posting Virtuoso

Here are some actual logged maintenance complaints (also called the gripe sheet) as submitted by Quantas pilots (P) and the solution recorded by maintenance engineers (S):

P: Left inside main tire almost needs replacement.
S: Almost replaced left inside main tire.

P: Test flight OK, except auto-land very rough.
S: Auto-land not installed on this aircraft.

P: Something loose in cockpit.
S: Something tightened in cockpit.

P: Dead bugs on windshield.
S: Live bugs on back-order.

P: Autopilot in altitude-hold mode produces a 200 feet per minute descent.
S: Cannot reproduce problem on ground.

P: Evidence of leak on right main landing gear.
S: Evidence removed.

P: DME volume unbelievably loud.
S: DME volume set to more believable level.

P: Friction locks cause throttle levers to stick.
S: That’s what they’re there for.

Note: Quantas has the best safety record of all major airlines, looks like a little humour helps.

Ene Uran 638 Posting Virtuoso

"As house prices fall, a huge amount of financial folly is being exposed. You only learn who has been swimming naked when the tide goes out -- and what we are witnessing at some of our largest financial institutions is an ugly sight."
Just quoted by Warren Buffett

Ene Uran 638 Posting Virtuoso

Very sad........

I agree, sailing enthusiast should not end up in hell!

Ene Uran 638 Posting Virtuoso

An elderly woman from Brooklyn decided to prepare her will and make her final requests. She told her rabbi she had two final requests.

First, she wanted to be cremated, and second, she wanted her ashes scattered over Bloomingdales.

“Bloomingdales!” the rabbi exclaimed, “Why Bloomingdales?”

“Then I’ll be sure my daughters visit me twice a week.”

Ene Uran 638 Posting Virtuoso

Aw crap. There goes the fun.

Well, there is always 2012, when the lineup of objects in space might favor your preferred candidate due to the larger mass on the right side.

Ene Uran 638 Posting Virtuoso

Strange women who call me sweety and honey. Drives me up the wall because I might not even know them! If a man said that to a strange woman he would get arrested for sexual harrasment.

I would only call a strange man 'sweety' or 'honey', if he is old enough and doesn't stand a chance in hell to be such.

Ene Uran 638 Posting Virtuoso

I'm half way through my second watermelon, and have one more after that. Oh yeah, just remembered the battered surimi chunks, bonus.

What's the record distance you have been able to spit the seeds?

I am munchig on a butter waffle cookie.

Ene Uran 638 Posting Virtuoso

The average American kitchen has 2.4 pots for every pan.

What do you do with 0.4 of a pot?

Ene Uran 638 Posting Virtuoso

Too many people miss the silver lining because they’re expecting gold.

Ene Uran 638 Posting Virtuoso

I work in a hospital and patients that suffer from terminal cancer simply don't think like that! This must be a silly hoax.

Ene Uran 638 Posting Virtuoso

As an actor Picard beats Kirk. Of cousre, Kirk's role is often written more than silly.

Ene Uran 638 Posting Virtuoso

If i have an audio file that is in .py format how do I play it?

Try to read it with an editor. If it looks like a typical Python code text file then the .py extension might be correct, otherwise it just might be a cruel joke. Anyone can take a .mp3 file and rename with a .py extension.

Ene Uran 638 Posting Virtuoso

Honestly, few of us are mind-readers, you need to give us more information and code.

Ene Uran 638 Posting Virtuoso

#!/usr/bin/python
is only needed for Linux computers.

print "\n" * 100
is a crude way to clear the cmd screen. Are you sure you need this at all?

Also, easygui is a subset wrapper for the Tkinter GUI toolkit. Very few people use it. I would switch to Tkinter that comes with most any Python installation.

Ene Uran 638 Posting Virtuoso

Please use code tags with your code to preserve the indentations. Otherwise the code is very difficult to read and not too many folks will help.

[code=python]
your Python code here

[/code]

Ene Uran 638 Posting Virtuoso

Just a side note, you can use x**0.5 rather than math.sqrt(x) to speed things up:

import timeit

stmt = "math.sqrt(123456789)"
t = timeit.Timer( stmt, "import math" )
print "%s took %s microseconds/pass" % (stmt, t.timeit(1000000))


stmt = "123456789**0.5"
t = timeit.Timer( stmt)
print "%s took %s microseconds/pass" % (stmt, t.timeit(1000000))

"""
my result --->
math.sqrt(123456789) took 1.21041132 microseconds/pass
123456789**0.5 took 0.11569164 microseconds/pass
"""
Ene Uran 638 Posting Virtuoso

We learned that it is only used for function arguments, and ** indicates a dictionary of variable number of key:val arguments.

Ene Uran 638 Posting Virtuoso

Nice clean code there Lardmeister. Did you switch from C# to Python?

Ene Uran 638 Posting Virtuoso

My assumption is that the newer members joining after Dani's somewhat dated statistics are younger.

Ene Uran 638 Posting Virtuoso

it all depends on how bad the alergy is. My sister has a rather severe case, she has to be extremely careful when buying prepackaged foods as most contain milk components as filler or for other purposes (even stuff you wouldn't expect it from, like marmelade).
She gets sick when she's had something to eat that was cooked in a pan that had previously contained butter and not been cleaned well enough...

Sad story! Was she a smoker?

Ene Uran 638 Posting Virtuoso

One general to the other:
"Live and let live!"

Ene Uran 638 Posting Virtuoso

Excess on occasion is exhilarating. It prevents moderation from acquiring the deadening effect of a habit.
Quoted by Somerset Maugham

Ene Uran 638 Posting Virtuoso

Ah, "poodly", meaning act like a well trained poodle, a new word for the dictionary.

JB, how is your former main poodle, forgot his name, doing these days?

Strange, when I look at dogs I think of poodle being French, terrier being English, and dachshund being German.

Ene Uran 638 Posting Virtuoso

Lardmeister, I think you are okay. That's why they give you a warning at first, much milder than an infraction.

Not quite sure what happens if you get warnings on totally different 'bad behaviour'? Do two warnings add up to an infraction no matter what? That would make it hard for you to test the limits. It's tough to beat kids, I mean younger folks, into submission.

Ene Uran 638 Posting Virtuoso

Hey Henri, thanks for the info on Python30.

Ene Uran 638 Posting Virtuoso

My advice to you is get married: if you find a good wife you'll be happy; if not, you'll become a philosopher.
Quoted by Socrates