Venku Tur'Mukan 0 Newbie Poster

I've recently become interested in trying to adapt my Rock-Paper-Scissors game into a multiplayer-friendly program, so today I decided I'd look up a tutorial on servers. It seems I'm following it precisely (aside from using a different IDE). However, something is going wrong and I'm not sure exactly what it is. I've looked up EOFException but it all felt like a bunch of super-behind-the-scenes mumbo jumbo that I wouldn't understand.

The tutorial

My screenshot

Could it possibly be as simple as forwarding port 7777?

Venku Tur'Mukan 0 Newbie Poster

This code is using the Zelle graphics module (derived from Tkinter)
free from: http://mcsp.wartburg.edu/zelle/python/graphics.py

Thanks, Vegaseat, but how/where is this implemented? Is there a folder that I can save a module named "graphics" in or something? Thank ya muchly!

Venku Tur'Mukan 0 Newbie Poster

Why are using if and if, why not try if, elif, that's better syntax wise.

I think I understand why. Anywho, I've implemented if/elif in a new "program" (no, seriously, I can't really call any of my scripting "programs" yet).
Thanks for all your help. I don't know if I should declare this thread "resolved" yet, as I haven't looked at my equation-chooser lately, but I'll let you know if I have anything else.

Venku Tur'Mukan 0 Newbie Poster

Thanks, you were both helpful!
I knew to use "==" but when I noticed the "is" statement I was confused.

Thanks again!

Venku Tur'Mukan 0 Newbie Poster

print "Hello, World!"
;)
Hi, everyone, Venku (a.k.a Python Newb) here.
I just kind of randomly opened up Python today (I do that a lot), and I decided I would finally ask this:

What does the "is" statement do in Python 2.7.1 (if the ver# matters)?

I checked out the Python command line (used "help()" "modules" "is"), but it only gave a comparison to C and an unintelligible description of what it does. I have an extensive vocabulary, and I am great with grammar and spelling, but the terminology, like "collection" and "membership" confused me.

It appears to be used in boolean operations (equal, not equal, etc.).
I wouldn't call myself a programmer just yet, but I'm very interested in Python and think it could be applied effectively in many environments, as it's so flexible.

Basically, I'm asking for a n00b explanation of "is."
:P

Venku Tur'Mukan 0 Newbie Poster

I have to write a program in Python that creates two circles colliding to each other and to the sides of the window. Here is what I have so far, but the problem is that they don't collide and they don't bump against the walls.
Please tell me what i'm doing wrong or if i'm missing something. Thank you

from time import *

from graphics import *

Hi there!
I was going to copy/paste this into Python to see how your code was so far (even though you said it doesn't really work the way you want it to) and then see if I could work it out (despite the fact that I'm a Python newb). But... Python says it doesn't have a module named "graphics." This is 2.7.1, BTW. Do I need an add-on? Sorry about my newby-ism. :P

Venku Tur'Mukan 0 Newbie Poster

Hi, all!

I joined... about a month ago (I suppose I should check how long I've been here at some point). Anyway, I like the help that I've gotten so far.
I use Python 2.7.1 to write small programs (at the moment). They're not very sophisticated... at all. But, Python is my first official programming language I'm learning. It's pretty straightforward and I'd recommend it to anyone interested in scripting.
I'm a student (young adult, age will remain untold) in an online school called Connections Academy. The environment is insanely flexible and the teachers are great.
I also use the UDK (Unreal Development Kit). The engine is beautiful and it holds a special place in my heart. When I was young my uncle let me borrow his (original) Xbox. I have a Star Wars Clone Wars miniseries DVD that has a Star Wars: Republic Commando demo on it. I loved it. I played that level over and over and never got tired of it. When I finally got the whole game for computer, I found out I could make my own maps for it with a modified version of UT2004. Then I found out I could use the latest and greatest edition of it for free on pretty much any computer.
So, that's what's been the center of my computer-based creativity since... December or something.

Live long and prosper and may the Force be with you!

Venku Tur'Mukan 0 Newbie Poster

Why are using if and if, why not try if, elif, that's better syntax wise.

Hm. I suppose it is.
I have more questions as well for Python... should we continue using this thread, or should I start a new one for each topic I have?

Venku Tur'Mukan 0 Newbie Poster

By upvote you mean... (sorry, DaniWeb newb).

Hm. I think I got it. The up arrow to the right of your post... right?

Venku Tur'Mukan 0 Newbie Poster

well you can upvote me a little if you care to.
Thanks

By upvote you mean... (sorry, DaniWeb newb).

Venku Tur'Mukan 0 Newbie Poster
print "Equations"

print "a+1 (1), a+2 (2), a+3 (3), a+4 (4)"

while True:
	d=int(raw_input("number:" ))
	if d==0:
		break;
	if d == 1:
		print a+1
		
## Then continue from there

That, my friend, is a beautiful piece of code. Sorry if I seem like a kid in a candy store, but I love seeing things that just... work!
You guys have all been a great help to me. I'll keep you posted on any improvements or issues in my programs.

Venku Tur'Mukan 0 Newbie Poster

Set d anything but empty value meaning false at line 5, for example:

d = "My value is True"

Then reconsider the variable names and read the PEP8 to prepare for the future.

Dude, thanks! :icon_cheesygrin:

Venku Tur'Mukan 0 Newbie Poster

Okay, this is all great (and like I said, I'll clean up the print statements and whatnot when I have the code down), but I still have the issue of the program asking for the equation twice. I have to define d, and then use it in the loop. But this causes the raw_input to be displayed twice, and that's kind of annoying.

print "Equations"

print "a+1 (1), a+2 (2), a+3 (3), a+4 (4)"

d=raw_input("choose equation")

while d:

    d=raw_input("choose equation")

    if d == "1":
        print "a+1"
        a = input("enter a")
        print a + 1

...and so on.
Is there a way to bypass the first raw_input since it does absolutely nothing?
I've tried, but apparently I haven't tried hard enough.

Venku Tur'Mukan 0 Newbie Poster

That works, although if you'd ever want to execute any code after the loop, then exit() wouldn't allow you too. If in the future you would like to extend your program to execute statements after the "while" loop then use something like:

if e == "Y":
    break

which at this point does the same thing as exit() because there's no code after the loop.

Thanks, man, that works wonders. :)

Venku Tur'Mukan 0 Newbie Poster

try simplify the logic and what you want to achieve. This could be done in well optimised way.

How do you mean? Just write it out as if I was planning a website or something?
I.E., make a map of how I want things to work in simpler terms?

Venku Tur'Mukan 0 Newbie Poster

a = I lived in my parents' basement (until we moved), but I'm in high school.
while a:
I probably don't have a goatee or ponytail.

I don't even know what He-Man is. Who doesn't love Star Wars? It's an epic American pasttime. Who doesn't love it, deep down? If you say "Use the Force, Luke" everybody around you is going to know what you're talking about.

South Park kind of sucks.

You spelled "Ni" wrong, dude.

Oh, I suppose you said Star Trek. Whatever. It's still a legacy.

Venku Tur'Mukan 0 Newbie Poster

The answer is yes, they live in their parent's basement, most sport goatees and/or ponytails, have various collections of toys (Star Wars, He-Man, etc.) and can quote movies, Star Trek episodes and South Park endlessly.
And when they don't like something, they'll pull out a "Nee" or two.

a = I lived in my parents' basement (until we moved), but I'm in high school.
while a:
I probably don't have a goatee or ponytail.

I don't even know what He-Man is. Who doesn't love Star Wars? It's an epic American pasttime. Who doesn't love it, deep down? If you say "Use the Force, Luke" everybody around you is going to know what you're talking about.

South Park kind of sucks.

You spelled "Ni" wrong, dude.

Venku Tur'Mukan 0 Newbie Poster

Yes.

If Pinocchio said "My nose will grow" would his nose grow?

Venku Tur'Mukan 0 Newbie Poster

I re-wrote my code...

print "Equations"

print "a+1 (1), a+2 (2), a+3 (3), a+4 (4)"

d=raw_input("choose equation")

while d:

    d=raw_input("choose equation")

    if d == "1":
        print "a+1"
        a = input("enter a")
        print a + 1
        
    if d == "2":
        print "a+2"
        a = input("enter a")
        print a + 2
        
    if d == "3":
        print "a+3"
        a = input("enter a")
        print a + 3

    if d == "4":
        print "a+4"
        a = input("enter a")
        print a + 4

    if d=="exit":
        exit()

But now it asks for the equation twice. Also, how would I make the program quit without IDLE asking if the user wants to kill the program?

(*facepalm*) Jeez, I should really think of things before I post. It asks for the equation twice ONLY at the start of the program. At that point it's just fine. But it doesn't even need to be the same equation. It's easy enough to get past, it's just annoying. I'll make the final program look neater when I have the coding down.
BTW:

if d=="exit":
        e=raw_input("Do you really want to exit? (Y/N): ")
        if e=="Y":
            exit()
        if e=="N":
            continue

...Me likey. :)

Venku Tur'Mukan 0 Newbie Poster

I re-wrote my code...

print "Equations"

print "a+1 (1), a+2 (2), a+3 (3), a+4 (4)"

d=raw_input("choose equation")

while d:

    d=raw_input("choose equation")

    if d == "1":
        print "a+1"
        a = input("enter a")
        print a + 1
        
    if d == "2":
        print "a+2"
        a = input("enter a")
        print a + 2
        
    if d == "3":
        print "a+3"
        a = input("enter a")
        print a + 3

    if d == "4":
        print "a+4"
        a = input("enter a")
        print a + 4

    if d=="exit":
        exit()

But now it asks for the equation twice. Also, how would I make the program quit without IDLE asking if the user wants to kill the program?

Venku Tur'Mukan 0 Newbie Poster

Aw, man... Now I need to do some debugging. Wait a while. I have homework to do, but I want to get this figured out.

Venku Tur'Mukan 0 Newbie Poster

Whoops. I totally screwed up my code on here. I'll edit it to actually work.
Sorry if I weirded you out with the e, f, and g things. Those weren't supposed to be there.

Venku Tur'Mukan 0 Newbie Poster

Hey, everybody, I'm a newbie at Python (2.7.1), and new to DaniWeb as well. and the apparent simplicity of Python got me interested in programming (seriously, the only thing before this was HTML).
Anyway...
I was taking a test and thought that after I was finished I could make an equation calculator. I've got a few simple equations slapped on there, for proof-of-concept, and they work fine. However, I would like to go back to the user input line of code. How do I go about doing this? I've Googled it, and there's no "goto" function like there is in C, I guess.
Well, here's the code.

print "Equations"

print "a+1 (1), a+2 (2), a+3 (3), a+4 (4)"

d=raw_input("choose equation")

while d:

    if d == "1":
        print "a+1"
        e = input("enter a")
        print e + 1
        
    if d == "2":
        print "a+2"
        e = input("enter a")
        print f + 2
        
    if d == "3":
        print "a+3"
        e = input("enter a")
        print g + 3

    if d == "4":
        print "a+4"
        e = input("enter a")
        print g + 4

Remember, guys, totally a newb.