On 8/9/2013 15:43, Kimberly Mansfield wrote: > This is the first homework assignment. Driving me crazy - struggling with > it for two entire days. I want to drop this class now. > > I think it is all entered correctly, but it won't run and teacher will not > accept it if it won't run. Says "syntax error" and highlights one of the > numbers in the top line that was there when I first opened it, before I > typed anything. Specifically, this: > Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC v.1600 32 > bit (Intel)] on win32
But that line should NOT be in your source file. That's the prompt the interpreter displays. > The middle 3 (in red) is highlighted. There is no arrow pointing to it or > anything else. We are supposed to write something to help a pizza parlor > owner figure out how many pepperoni sticks he will need for the month. The > teacher gave us an IPO chart with these definitions and we are supposed to > write the code for it in Python. I used floats throughout because this is > the umpteenth time I have rewritten this thing, and was thinking maybe it > was because I used integers as well as floats before, and thought maybe the > problem was because I used both. > I will post it below in case you need to see the whole thing. > Obviously, I have no programming background and this is supposed to be a > beginner's class. > Please help. I am running out of hair to yank out of my head and my dogs > are afraid of me now. > > Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC v.1600 32 > bit (Intel)] on win32 > Type "copyright", "credits" or "license()" for more information. Why are you typing all this into the interpreter? >>>> Pizzas = float (input ("Number of Pizzas ")) > Number of Pizzas 100 >>>> Length = float (input ("Length of Pizzas ")) > Length of Pizzas 11 >>>> Width = float (input ("Width of Pizzas ")) > Width of Pizzas 11 >>>> Thickness = float (input ("Thickness of Pepperoni Slices ")) > Thickness of Pepperoni Slices .1 >>>> Diameter = float (input ("Diameter of Pepperoni Slices ")) > Diameter of Pepperoni Slices 1 >>>> Edge = float (input ("Crust Edge of Pizzas ")) > Crust Edge of Pizzas .5 >>>> StickLength = float (input ("Length of Pepperoni Sticks ")) > Length of Pepperoni Sticks 10 >>>> UsefulLength = Length - 2 * Edge >>>> SlicesLength = UsefulLength / Diameter >>>> UsefulWidth = Width - 2 * Edge >>>> SlicesWidth = UsefulWidth / Diameter >>>> Slices = SlicesWidth * SlicesLength >>>> TotalSlices = Slices * Pizzas >>>> HypoLength = TotalSlices * Thickness >>>> PepperoniSticks = HypoLength / StickLength >>>> print (StickLength) > 10.0 >>>> print ("You will need", PepperoniSticks, "pepperoni sticks this month.") > You will need 100.0 pepperoni sticks this month. > <Snipped HTMl junk. Please send messages as text> Have you got a text editor? (Even Notepad is good enough for a case like this) Nobody should write a program of this size directly in the interpreter. You certainly don't want to be retyping the whole thing when there's one typo. Start simple. Create a text file called simple.py, and consisting of one line: print("Hello world") Now run that file, by typing python simple.py If that works for you, you've got a clue how to write a longer program. -- DaveA _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor