[Tutor] Won't run. Syntax Error.

Jay Lozier jslozier at gmail.com
Sun Sep 8 22:35:30 CEST 2013


-----Original Message-----
From: Kimberly Mansfield <kimberly.mansfield at g.austincc.edu>
To: tutor at python.org
Subject: [Tutor] Won't run. Syntax Error.
Date: Sun, 8 Sep 2013 14:43:54 -0500

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   

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.
>>> 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. 


Kimberly,

Your output indicates the code runs correctly as written. There are no
error messages.

I was able to run the code without any errors. I copied and pasted the
code into a text editor (Notepad on Windows or idle3) and removed the
extraneous prompts, echoed output, and spaces.

When saving the file the extension should be *.py.as in pizza.py 
-- 
Jay Lozier
jslozier at gmail.com



More information about the Tutor mailing list