On 21/12/13 20:36, NZHacker1 . wrote:
I'm trying to make a lottery in python and I keep getting this error.

There's an error in your program:
***Cant assign to operator.(Mega Millions, line 47)

Did you read the replies sent last time?
Did you understand them? It seems unlikely since you
haven't changed anything...

import random
.....

x = raw_input('Money in pennys.')
Plays = int(x) * 100
plays = int(x) * 100
z = 0
Game = ('Game')

The () are not doing anything here, you don't need them.


while Plays != 0:
     Plays = Plays - 1
     z = z + 1
...
   Game + z = N1 + N2 + N3 + N4 + N5 + MB

You cannot assign a value to an expression.
If we knew what you expected this line to do we can help you find another way to express it that Python can understand. But since we don't understand what you are trying to do we can't help you.

z = 0
while plays != 0:
     Plays = Plays - 1
     z = z + 1
     print(Game + str(z))

testing 'plays' but modifying 'Plays' will result in an infinite
loop. Your program will lock up if it ever gets to here.

Line 47 in highlighted in red.

Colours and fonts don't work in a plain text mailing list.
But we can see the faulty line without that. What would help
more is if you posted the real error message in it's entirety.

I'm not finished with the program and I put Plays = int(x) * 100,
plays = int(x) * 100
on purpose.

Having two variables with very similar names is going to make
your code harder to maintain. Its much better to clearly
differentiate the names, perhaps adding a tag to indicate
the purpose of each. But if you insist on keeping the names
similar then its legal Python and you will just need to
remember when you use each.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to