0

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()
3
Contributors
6
Replies
11
Views
5 Years
Discussion Span
Last Post by Jacklittle01
0

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.

0

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

Edited by M.S.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.