can someone correct this code for me? also, how do you make cmd open the .py file than execute that .py?

def addition()
    print "This part of the test cover addition"
    p1 = raw_input "What is 9+9"
    if p1 = "18"
    set c()= c+1 
    c= 0
    print "correct"
    else: print "Incorrect"
def addition()

Recommended Answers

All 6 Replies

what do you mean
just asked for help

i learned online. just please correct this code. plz makes lolcat face

As I posted, the Tutorial is really helpfull. For example, you could learn how to define and call functions (and raw_input is one function also): http://docs.python.org/tutorial/controlflow.html#defining-functions

And maybe one learning Python should be expected to learn to indent code himself. That is what forum rules mean when they tell:

  • Do provide evidence of having done some work yourself if posting questions from school or work assignments

And for me it applies for self learning online also.

The very first thing to learn in any situation is THE RULES.
And Python has few rules such as Indentation, Style and.. that you need to learn first.

def some_function():
    #some notes here
    while some_condition:
        if some_other_condition:
            some=process+here
        else:
            some=other*process+here

Ok I learned that when doing raw_input you must use parenthesis. Now what

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.