Thank you for posting your code.

Did you forget to reply-all? I am copying this to the list this time.

You apparantly misunderstood my question about what you do to run the program. You said " I import then call the first function (the displaymenu) or I have it called in the code it does it automatically".

I am running out of patience trying to get from you what we as a Tutor List need in order to help you.

Please answer the following:
What operating system are you using (Windows, Linux, Mac, ...)
WHAT DO YOU DO RUN THE PROGRAM. I gave detailed examples of potential answers (see below). Do you not understand what I'm looking for?

On 3/30/2012 11:22 PM, chris knarvik wrote:
Also here is my revised code with what i call a 'programmers error' let me know if you see it because i dont

Why all the imports - you are not using any math, os or sys code. Also You should not do 2 different imports from math. It is better to drop the from ...
import math
import os, sys
from math import *

def displaymenu():
    print 'please make a selection';
    print 'Area (1)';
    choice = raw_input('enter selection number')
OK time to learn how to debug.
Since the code goes from if to print, the if condition (choice == 1) must be False.
What datatype does raw_input give you?
Why would that cause the condition to be False?
One way to answer that is to read the manual regarding raw_input.
Another is to use print statements with type() to tell you the types.
Therefore just before the if put
print type(choice), type(1)

    if choice == 1:
       selctiona()
    else:
        print'choice',choice,'is wrong'
        print"why god wont this thing work"


def areamenu():
    print 'Square (1)'
    print 'triangle (2)'
    print 'rectangle (3)'
    print 'trapazoid (4)'
    print 'circle (5)'

def selctiona():
    areamenu();
    choicea = raw_input('enter selection');
    if choicea == 1:
       squareacalc()

    else:
        print 'why god why'

def squareacalc():
    sidelength = input('enter side length: ')
    print "The Area Is", sidelength **2

You don't seem to call reloadarea!
def reloadarea():
   print 'would you like to calculate again'
   choicer = raw_input('yes(1) or no(2)')
   if choicer == 1:
This is called recursion. It is better in this kind of program to put the entire thing in a while loop(see below)* rather than to use a recursive call.
       displaymenu()
   elif choicer == 2:
       print 'goodbye'

displaymenu()

i cant get past the display menu i get this result
please make a selection
Area (1)
enter selection number1
choice 1 is wrong
why god wont this thing work
<module 'Area' from 'C:\Python27\Area.py'>
>>>
let me know if you can see where i went wrong

I hope the guidance I gave above helps.

* Using a while loop instead of recursion:
while True:
  displaymenu()
  print 'would you like to calculate again'
  choicer = raw_input('yes(1) or no(2)')
if choicer == 2: # this also will not work, for the same reason that choice == 1 does not work. Once you fix choice == 1 then you can also fix this.
    break




            what do you mean what do i do to run it

        There are several ways to execute (run) a Python program.
        You can double-click the file in an explorer.
        You can at a command prompt type (e.g.) >python Area.py
        or you can start an interactive session then type >>>import Area
        or you can use an IDE such as IDLE.
         within IDLE you can write the program in an edit window then RUN
         or you can use the interactive window and type >>>import Area
Which of these (or what else) do you do


--
Bob Gailer
919-636-4239
Chapel Hill NC

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

Reply via email to