473,588 Members | 2,465 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

need help with python

ya so im pretty much a newb to this whole python thing... its pretty
cool but i just started today and im already having trouble. i
started to use a tutorial that i found somewhere and i followed the
instructions and couldnt get the correct results. heres the code
stuff...

temperature=inp ut("what is the temperature of the spam?")
if temperature>50:
print "the salad is properly cooked."
else:
print "cook the salad some more."

ya i was trying to do that but when i told it what the spams
temperature was, it just turned off... well it wasnt working at all at
first until i realized that i hadnt been following the instructions
completely correctly and that i was supposed to type that code up in a
notepad then save and open with python... so ya thats when it asked me
what temperature the spam was and i typed a number then it just closed
itself... im not really sure what went wrong... itd be real nice if
someone would be like a mentor or something...

May 12 '07 #1
12 2993
On 11 May 2007 18:47:27 -0700, ad*******@hotma il.com
<ad*******@hotm ail.comwrote:
ya so im pretty much a newb to this whole python thing... its pretty
cool but i just started today and im already having trouble. i
started to use a tutorial that i found somewhere and i followed the
instructions and couldnt get the correct results. heres the code
stuff...

temperature=inp ut("what is the temperature of the spam?")
if temperature>50:
print "the salad is properly cooked."
else:
print "cook the salad some more."

ya i was trying to do that but when i told it what the spams
temperature was, it just turned off... well it wasnt working at all at
first until i realized that i hadnt been following the instructions
completely correctly and that i was supposed to type that code up in a
notepad then save and open with python... so ya thats when it asked me
what temperature the spam was and i typed a number then it just closed
itself... im not really sure what went wrong... itd be real nice if
someone would be like a mentor or something...
I'm making a couple of assumptions here (correct me if I'm wrong):

1. You're using windows
2. You double clicked on the .py file

What this does is open up a new terminal window and start execution of
the program. The program will execute to completion and then the
window will close automatically without waiting for you to tell it to
(lovely isn't it?). To get around this you have a couple options:

1. Run the script from the command line
2. Put this at the end of the .py file: input('Press ENTER to continue')

Ian
May 12 '07 #2
On May 11, 9:11 pm, "Ian Clark" <turb...@gmail. comwrote:
On 11 May 2007 18:47:27 -0700, adamur...@hotma il.com

<adamur...@hotm ail.comwrote:
ya so im pretty much a newb to this whole python thing... its pretty
cool but i just started today and im already having trouble. i
started to use a tutorial that i found somewhere and i followed the
instructions and couldnt get the correct results. heres the code
stuff...
temperature=inp ut("what is the temperature of the spam?")
if temperature>50:
print "the salad is properly cooked."
else:
print "cook the salad some more."
ya i was trying to do that but when i told it what the spams
temperature was, it just turned off... well it wasnt working at all at
first until i realized that i hadnt been following the instructions
completely correctly and that i was supposed to type that code up in a
notepad then save and open with python... so ya thats when it asked me
what temperature the spam was and i typed a number then it just closed
itself... im not really sure what went wrong... itd be real nice if
someone would be like a mentor or something...

I'm making a couple of assumptions here (correct me if I'm wrong):

1. You're using windows
2. You double clicked on the .py file

What this does is open up a new terminal window and start execution of
the program. The program will execute to completion and then the
window will close automatically without waiting for you to tell it to
(lovely isn't it?). To get around this you have a couple options:

1. Run the script from the command line
2. Put this at the end of the .py file: input('Press ENTER to continue')

Ian
ok u used a bunch of fancy words in there... im not sure what a .py
file is... i am using windows... i dont know what a terminal window is
but im gonna asume that it is when you click the python thing... ya i
kinda understand what ur sayin but the thing is i wanted it to give
feedback to my question and why would it do that... hmmm very
confusing... im not sure how to run the script from the command
line... oh yeah the enter thing worked. thanks for that... oh the
command line must be the lil black box... if i put it there then it
will give me a bunch of syntax this and error that kinda stuff...
thats why im putin it in the notepad and plus the tutorial said to...

May 12 '07 #3
On May 11, 8:47 pm, adamur...@hotma il.com wrote:
ya so im pretty much a newb to this whole python thing... its pretty
cool but i just started today and im already having trouble. i
started to use a tutorial that i found somewhere and i followed the
instructions and couldnt get the correct results. heres the code
stuff...

temperature=inp ut("what is the temperature of the spam?")
if temperature>50:
print "the salad is properly cooked."
else:
print "cook the salad some more."

ya i was trying to do that but when i told it what the spams
temperature was, it just turned off... well it wasnt working at all at
first until i realized that i hadnt been following the instructions
completely correctly and that i was supposed to type that code up in a
notepad then save and open with python... so ya thats when it asked me
what temperature the spam was and i typed a number then it just closed
itself... im not really sure what went wrong... itd be real nice if
someone would be like a mentor or something...
Well, this list has a varying level of mentoring and newbie-tolerance,
with more latitude for people who have made some effort to start with
before posting things like "here's my homework problem, please send me
the working code so I can hand it in."

I just ran your code interactively at the Python prompt, and it runs
just fine. See?
>>temperature=i nput("what is the temperature of the spam?")
what is the temperature of the spam?55
>>if temperature>50:
.... print "the salad is properly cooked."
.... else:
.... print "the salad is properly cooked."
....
the salad is properly cooked.

I think the problem you are having is that, when you run your program
by double-clicking on the xyz.py file in a file browser, the OS
(Windows, I assume?) opens a separate console window, and runs the
program, and then at the end of the program, CLOSES the window. I
think your code is running just fine, I think your "the salad is
whatever" messages get printed out, but afterward, your program ends,
so the window closes before you can see how your salad turned out.

A simple workaround you can do is to add to the end of your program
this statement:

input("<press return to end program>")

This will cause the process to stop and wait for you to press the
RETURN key, giving you time to stop and admire your salad results
before closing the window.

One final note: many people post in a "write like I talk" style. This
is okay while telling your story ("well it wasn't working at all at
first..."), and the ee cummings all-lower-case is passable, but please
drop the "ya"s. They are a verbal tic that may be okay in person, but
do not translate at all to written posts. At least you don't say
"like" every other word, and I thank you for that! :)

You can get a sense of other writing styles by reading through the
comp.lang.pytho n archives. I would also recommend that you might find
more folks in the "just getting started" phase posting to the python-
tutor mailing list (go to http://mail.python.org/mailman/listinfo/tutor),
and you can skim through posts there for many introductory topics.

Good luck to you, and welcome to Python!

-- Paul

May 12 '07 #4
On May 11, 9:34 pm, Paul McGuire <p...@austin.rr .comwrote:
On May 11, 8:47 pm, adamur...@hotma il.com wrote:
ya so im pretty much a newb to this whole python thing... its pretty
cool but i just started today and im already having trouble. i
started to use a tutorial that i found somewhere and i followed the
instructions and couldnt get the correct results. heres the code
stuff...
temperature=inp ut("what is the temperature of the spam?")
if temperature>50:
print "the salad is properly cooked."
else:
print "cook the salad some more."
ya i was trying to do that but when i told it what the spams
temperature was, it just turned off... well it wasnt working at all at
first until i realized that i hadnt been following the instructions
completely correctly and that i was supposed to type that code up in a
notepad then save and open with python... so ya thats when it asked me
what temperature the spam was and i typed a number then it just closed
itself... im not really sure what went wrong... itd be real nice if
someone would be like a mentor or something...

Well, this list has a varying level of mentoring and newbie-tolerance,
with more latitude for people who have made some effort to start with
before posting things like "here's my homework problem, please send me
the working code so I can hand it in."

I just ran your code interactively at the Python prompt, and it runs
just fine. See?
>temperature=in put("what is the temperature of the spam?")

what is the temperature of the spam?55>>if temperature>50:

... print "the salad is properly cooked."
... else:
... print "the salad is properly cooked."
...
the salad is properly cooked.

I think the problem you are having is that, when you run your program
by double-clicking on the xyz.py file in a file browser, the OS
(Windows, I assume?) opens a separate console window, and runs the
program, and then at the end of the program, CLOSES the window. I
think your code is running just fine, I think your "the salad is
whatever" messages get printed out, but afterward, your program ends,
so the window closes before you can see how your salad turned out.

A simple workaround you can do is to add to the end of your program
this statement:

input("<press return to end program>")

This will cause the process to stop and wait for you to press the
RETURN key, giving you time to stop and admire your salad results
before closing the window.

One final note: many people post in a "write like I talk" style. This
is okay while telling your story ("well it wasn't working at all at
first..."), and the ee cummings all-lower-case is passable, but please
drop the "ya"s. They are a verbal tic that may be okay in person, but
do not translate at all to written posts. At least you don't say
"like" every other word, and I thank you for that! :)

You can get a sense of other writing styles by reading through the
comp.lang.pytho n archives. I would also recommend that you might find
more folks in the "just getting started" phase posting to the python-
tutor mailing list (go tohttp://mail.python.org/mailman/listinfo/tutor),
and you can skim through posts there for many introductory topics.

Good luck to you, and welcome to Python!

-- Paul
well... i just discovered another of my mistakes. i was writing it in
notepad and not saving it as .py silly me... hoho ya that input thing
to get it to make u press enter worked tho... but only with that
one... ive got another one that i cant get to work even with the input
message to press enter. Sorry about the bad grammar. I'm used to
Myspace where no one gives a particular hoot about how you type. I
hope this is better. I will follow that link though. Thanks for the
help.

May 12 '07 #5
On May 11, 9:41 pm, adamur...@hotma il.com wrote:
On May 11, 9:34 pm, Paul McGuire <p...@austin.rr .comwrote:


On May 11, 8:47 pm, adamur...@hotma il.com wrote:
ya so im pretty much a newb to this whole python thing... its pretty
cool but i just started today and im already having trouble. i
started to use a tutorial that i found somewhere and i followed the
instructions and couldnt get the correct results. heres the code
stuff...
temperature=inp ut("what is the temperature of the spam?")
if temperature>50:
print "the salad is properly cooked."
else:
print "cook the salad some more."
ya i was trying to do that but when i told it what the spams
temperature was, it just turned off... well it wasnt working at all at
first until i realized that i hadnt been following the instructions
completely correctly and that i was supposed to type that code up in a
notepad then save and open with python... so ya thats when it asked me
what temperature the spam was and i typed a number then it just closed
itself... im not really sure what went wrong... itd be real nice if
someone would be like a mentor or something...
Well, this list has a varying level of mentoring and newbie-tolerance,
with more latitude for people who have made some effort to start with
before posting things like "here's my homework problem, please send me
the working code so I can hand it in."
I just ran your code interactively at the Python prompt, and it runs
just fine. See?
>>temperature=i nput("what is the temperature of the spam?")
what is the temperature of the spam?55>>if temperature>50:
... print "the salad is properly cooked."
... else:
... print "the salad is properly cooked."
...
the salad is properly cooked.
I think the problem you are having is that, when you run your program
by double-clicking on the xyz.py file in a file browser, the OS
(Windows, I assume?) opens a separate console window, and runs the
program, and then at the end of the program, CLOSES the window. I
think your code is running just fine, I think your "the salad is
whatever" messages get printed out, but afterward, your program ends,
so the window closes before you can see how your salad turned out.
A simple workaround you can do is to add to the end of your program
this statement:
input("<press return to end program>")
This will cause the process to stop and wait for you to press the
RETURN key, giving you time to stop and admire your salad results
before closing the window.
One final note: many people post in a "write like I talk" style. This
is okay while telling your story ("well it wasn't working at all at
first..."), and the ee cummings all-lower-case is passable, but please
drop the "ya"s. They are a verbal tic that may be okay in person, but
do not translate at all to written posts. At least you don't say
"like" every other word, and I thank you for that! :)
You can get a sense of other writing styles by reading through the
comp.lang.pytho n archives. I would also recommend that you might find
more folks in the "just getting started" phase posting to the python-
tutor mailing list (go tohttp://mail.python.org/mailman/listinfo/tutor),
and you can skim through posts there for many introductory topics.
Good luck to you, and welcome to Python!
-- Paul

well... i just discovered another of my mistakes. i was writing it in
notepad and not saving it as .py silly me... hoho ya that input thing
to get it to make u press enter worked tho... but only with that
one... ive got another one that i cant get to work even with the input
message to press enter. Sorry about the bad grammar. I'm used to
Myspace where no one gives a particular hoot about how you type. I
hope this is better. I will follow that link though. Thanks for the
help.- Hide quoted text -

- Show quoted text -
It's possible that your next program has a runtime error, which will
raise an exception that, if not handled using try-except, will cause
the program to exit with a message (a message that will flash by and
then disappear, as the window closes immediately).

One thing you should try is to run your python programs using a
terminal window (sometimes called a "console window", or "the command
line"). There are several ways to open one of these, the simplest on
Windows is to click the "Start" button in the lower left corner,
select "Run...", and enter the command "cmd". This will open up one
of these white-letters-on-black-background windows for typing system
commands. From this command line, you can run your Python programs by
typing "python blah.py" where blah.py is the name of your Python
script (which you created in Notepad and saved as blah.py. By running
scripts this way, you will get to see *all* of your program output,
without having the window close on you. (and please don't name all
your scripts "blah.py", you should pick different names...)

Another thing you might try is downloading and installing SciTE for
Windows - a free super-Notepad, with built-in support for editing *and
running* Python scripts. Enter your Python code, save it as
"whatever.p y", then press F5 - the editor will split down the middle,
keeping your program in the left half, and show the output messages
and exceptions on the right. I find this much easier than going back
and forth between Notepad and a terminal window. Other developer
editors (often called "IDE"s for Interactive Development Environment)
work similarly, such as pythonwin or IDLE - there are many others to
choose from, but coming from Notepad, SciTE will not be a big step,
but will move you forward.

-- Paul

May 12 '07 #6
On May 11, 10:16 pm, Paul McGuire <p...@austin.rr .comwrote:
On May 11, 9:41 pm, adamur...@hotma il.com wrote:
On May 11, 9:34 pm, Paul McGuire <p...@austin.rr .comwrote:
On May 11, 8:47 pm, adamur...@hotma il.com wrote:
ya so im pretty much a newb to this whole python thing... its pretty
cool but i just started today and im already having trouble. i
started to use a tutorial that i found somewhere and i followed the
instructions and couldnt get the correct results. heres the code
stuff...
temperature=inp ut("what is the temperature of the spam?")
if temperature>50:
print "the salad is properly cooked."
else:
print "cook the salad some more."
ya i was trying to do that but when i told it what the spams
temperature was, it just turned off... well it wasnt working at all at
first until i realized that i hadnt been following the instructions
completely correctly and that i was supposed to type that code up in a
notepad then save and open with python... so ya thats when it asked me
what temperature the spam was and i typed a number then it just closed
itself... im not really sure what went wrong... itd be real nice if
someone would be like a mentor or something...
Well, this list has a varying level of mentoring and newbie-tolerance,
with more latitude for people who have made some effort to start with
before posting things like "here's my homework problem, please send me
the working code so I can hand it in."
I just ran your code interactively at the Python prompt, and it runs
just fine. See?
>temperature=in put("what is the temperature of the spam?")
what is the temperature of the spam?55>>if temperature>50:
... print "the salad is properly cooked."
... else:
... print "the salad is properly cooked."
...
the salad is properly cooked.
I think the problem you are having is that, when you run your program
by double-clicking on the xyz.py file in a file browser, the OS
(Windows, I assume?) opens a separate console window, and runs the
program, and then at the end of the program, CLOSES the window. I
think your code is running just fine, I think your "the salad is
whatever" messages get printed out, but afterward, your program ends,
so the window closes before you can see how your salad turned out.
A simple workaround you can do is to add to the end of your program
this statement:
input("<press return to end program>")
This will cause the process to stop and wait for you to press the
RETURN key, giving you time to stop and admire your salad results
before closing the window.
One final note: many people post in a "write like I talk" style. This
is okay while telling your story ("well it wasn't working at all at
first..."), and the ee cummings all-lower-case is passable, but please
drop the "ya"s. They are a verbal tic that may be okay in person, but
do not translate at all to written posts. At least you don't say
"like" every other word, and I thank you for that! :)
You can get a sense of other writing styles by reading through the
comp.lang.pytho n archives. I would also recommend that you might find
more folks in the "just getting started" phase posting to the python-
tutor mailing list (go tohttp://mail.python.org/mailman/listinfo/tutor),
and you can skim through posts there for many introductory topics.
Good luck to you, and welcome to Python!
-- Paul
well... i just discovered another of my mistakes. i was writing it in
notepad and not saving it as .py silly me... hoho ya that input thing
to get it to make u press enter worked tho... but only with that
one... ive got another one that i cant get to work even with the input
message to press enter. Sorry about the bad grammar. I'm used to
Myspace where no one gives a particular hoot about how you type. I
hope this is better. I will follow that link though. Thanks for the
help.- Hide quoted text -
- Show quoted text -

It's possible that your next program has a runtime error, which will
raise an exception that, if not handled using try-except, will cause
the program to exit with a message (a message that will flash by and
then disappear, as the window closes immediately).

One thing you should try is to run your python programs using a
terminal window (sometimes called a "console window", or "the command
line"). There are several ways to open one of these, the simplest on
Windows is to click the "Start" button in the lower left corner,
select "Run...", and enter the command "cmd". This will open up one
of these white-letters-on-black-background windows for typing system
commands. From this command line, you can run your Python programs by
typing "python blah.py" where blah.py is the name of your Python
script (which you created in Notepad and saved as blah.py. By running
scripts this way, you will get to see *all* of your program output,
without having the window close on you. (and please don't name all
your scripts "blah.py", you should pick different names...)

Another thing you might try is downloading and installing SciTE for
Windows - a free super-Notepad, with built-in support for editing *and
running* Python scripts. Enter your Python code, save it as
"whatever.p y", then press F5 - the editor will split down the middle,
keeping your program in the left half, and show the output messages
and exceptions on the right. I find this much easier than going back
and forth between Notepad and a terminal window. Other developer
editors (often called "IDE"s for Interactive Development Environment)
work similarly, such as pythonwin or IDLE - there are many others to
choose from, but coming from Notepad, SciTE will not be a big step,
but will move you forward.

-- Paul
I was looking around in my Python folder and saw something to do with
that IDLE thing you were talking about. When I right clicked on a .py
file, it said edit with IDLE. I opened it and it was my code but each
line was a different color. It looked confusing so I decide to save
it for later. I knew that I could get the run thing to do the command
thing, but I had forgotten how to get the black window to come up.

Ok. Well, I tried to us the cmd window. It says python: can't open
file 'area.py' I'm guessing that's not good. It won't open any of
my .py files. It's because of where I saved them. I can see how this
i going to work now. Ok so I'll just move them to the place that the
command line says. Now it still won't run my other program:

# Area calculation program

print "Welcome to the Area calculation program"
print "-------------"
print

# Print out the menu:
print "Please select a shape:"
print "1 Rectangle"
print "2 Circle"

# Get the user's choice:
shape = input("")

# Calculate the area:
if shape == 1:
height = input("Please enter the height: ")
width = input("Please enter the width: ")
area = height*width
print "The area is", area
else:
radius = input("Please enter the radius: ")
area = 3.14*(radius**2 )
print "The area is", area

Perhaps it isn't written correctly. I don't think it likes the pound
signs. I'm not sure. But, I did go to that mailing list you
recommended. Thanks for that.

May 12 '07 #7
On May 11, 10:37 pm, adamur...@hotma il.com wrote:
On May 11, 10:16 pm, Paul McGuire <p...@austin.rr .comwrote:


On May 11, 9:41 pm, adamur...@hotma il.com wrote:
On May 11, 9:34 pm, Paul McGuire <p...@austin.rr .comwrote:
On May 11, 8:47 pm, adamur...@hotma il.com wrote:
ya so im pretty much a newb to this whole python thing... its pretty
cool but i just started today and im already having trouble. i
started to use a tutorial that i found somewhere and i followed the
instructions and couldnt get the correct results. heres the code
stuff...
temperature=inp ut("what is the temperature of the spam?")
if temperature>50:
print "the salad is properly cooked."
else:
print "cook the salad some more."
ya i was trying to do that but when i told it what the spams
temperature was, it just turned off... well it wasnt working at all at
first until i realized that i hadnt been following the instructions
completely correctly and that i was supposed to type that code up in a
notepad then save and open with python... so ya thats when it asked me
what temperature the spam was and i typed a number then it just closed
itself... im not really sure what went wrong... itd be real nice if
someone would be like a mentor or something...
Well, this list has a varying level of mentoring and newbie-tolerance,
with more latitude for people who have made some effort to start with
before posting things like "here's my homework problem, please send me
the working code so I can hand it in."
I just ran your code interactively at the Python prompt, and it runs
just fine. See?
>>temperature=i nput("what is the temperature of the spam?")
what is the temperature of the spam?55>>if temperature>50:
... print "the salad is properly cooked."
... else:
... print "the salad is properly cooked."
...
the salad is properly cooked.
I think the problem you are having is that, when you run your program
by double-clicking on the xyz.py file in a file browser, the OS
(Windows, I assume?) opens a separate console window, and runs the
program, and then at the end of the program, CLOSES the window. I
think your code is running just fine, I think your "the salad is
whatever" messages get printed out, but afterward, your program ends,
so the window closes before you can see how your salad turned out.
A simple workaround you can do is to add to the end of your program
this statement:
input("<press return to end program>")
This will cause the process to stop and wait for you to press the
RETURN key, giving you time to stop and admire your salad results
before closing the window.
One final note: many people post in a "write like I talk" style. This
is okay while telling your story ("well it wasn't working at all at
first..."), and the ee cummings all-lower-case is passable, but please
drop the "ya"s. They are a verbal tic that may be okay in person, but
do not translate at all to written posts. At least you don't say
"like" every other word, and I thank you for that! :)
You can get a sense of other writing styles by reading through the
comp.lang.pytho n archives. I would also recommend that you might find
more folks in the "just getting started" phase posting to the python-
tutor mailing list (go tohttp://mail.python.org/mailman/listinfo/tutor),
and you can skim through posts there for many introductory topics.
Good luck to you, and welcome to Python!
-- Paul
well... i just discovered another of my mistakes. i was writing it in
notepad and not saving it as .py silly me... hoho ya that input thing
to get it to make u press enter worked tho... but only with that
one... ive got another one that i cant get to work even with the input
message to press enter. Sorry about the bad grammar. I'm used to
Myspace where no one gives a particular hoot about how you type. I
hope this is better. I will follow that link though. Thanks for the
help.- Hide quoted text -
- Show quoted text -
It's possible that your next program has a runtime error, which will
raise an exception that, if not handled using try-except, will cause
the program to exit with a message (a message that will flash by and
then disappear, as the window closes immediately).
One thing you should try is to run your python programs using a
terminal window (sometimes called a "console window", or "the command
line"). There are several ways to open one of these, the simplest on
Windows is to click the "Start" button in the lower left corner,
select "Run...", and enter the command "cmd". This will open up one
of these white-letters-on-black-background windows for typing system
commands. From this command line, you can run your Python programs by
typing "python blah.py" where blah.py is the name of your Python
script (which you created in Notepad and saved as blah.py. By running
scripts this way, you will get to see *all* of your program output,
without having the window close on you. (and please don't name all
your scripts "blah.py", you should pick different names...)
Another thing you might try is downloading and installing SciTE for
Windows - a free super-Notepad, with built-in support for editing *and
running* Python scripts. Enter your Python code, save it as
"whatever.p y", then press F5 - the editor will split down the middle,
keeping your program in the left half, and show the output messages
and exceptions on the right. I find this much easier than going back
and forth between Notepad and a terminal window. Other developer
editors (often called "IDE"s for Interactive Development Environment)
work similarly, such as pythonwin or IDLE - there are many others to
choose from, but coming from Notepad, SciTE will not be a big step,
but will move you forward.
-- Paul

I was looking around in my Python folder and saw something to do with
that IDLE thing you were talking about. When I right clicked on a .py
file, it said edit with IDLE. I opened it and it was my code but each
line was a different color. It looked confusing so I decide to save
it for later. I knew that I could get the run thing to do the command
thing, but I had forgotten how to get the black window to come up.

Ok. Well, I tried to us the cmd window. It says python: can't open
file 'area.py' I'm guessing that's not good. It won't open any of
my .py files. It's because of where I saved them. I can see how this
i going to work now. Ok so I'll just move them to the place that the
command line says. Now it still won't run my other program:

# Area calculation program

print "Welcome to the Area calculation program"
print "-------------"
print

# Print out the menu:
print "Please select a shape:"
print "1 Rectangle"
print "2 Circle"

# Get the user's choice:
shape = input("")

# Calculate the area:
if shape == 1:
height = input("Please enter the height: ")
width = input("Please enter the width: ")
area = height*width
print "The area is", area
else:
radius = input("Please enter the radius: ")
area = 3.14*(radius**2 )
print "The area is", area

Perhaps it isn't written correctly. I don't think it likes the pound
signs. I'm not sure. But, I did go to that mailing list you
recommended. Thanks for that.- Hide quoted text -

- Show quoted text -
Again, this runs just fine for me. Here is the output when run within
SciTE:
Welcome to the Area calculation program
-------------

Please select a shape:
1 Rectangle
2 Circle
1
Please enter the height: 10
Please enter the width: 20
The area is 200
Welcome to the Area calculation program
-------------

Please select a shape:
1 Rectangle
2 Circle
2
Please enter the radius: 10
The area is 314.0
It seems like you are still struggling with mechanics of files,
directories, etc., although your last post indicates you're making
some progress there.

Now for a better posting hint. When you tell us "Now it still won't
run my other program", this isn't really enough to go on. What
happens when you type in "python area.py" (assuming that you have used
the 'cd' command to change your directory to the one containing
area.py)? When you post that something doesn't work, copy/paste the
error messages themselves into the post, and the actual Python code
that you ran.

But your problems do not seem to be Python problems at all, just OS
and script execution mechanics.

-- Paul

May 12 '07 #8
I'm not sure how you installed Python, or how you are using it, but I
made something last year to help Windows XP users who are brand new to
Python and can't get things to run, etc.

You might try either jumping into somewhere midway, or if you keep
having trouble, uninstall whatever you installed and start over using
this:

http://www.richarddooling.com/index....o-hello-world/

If that link breaks, use this:

http://tinyurl.com/w7wgp

Good luck.

rd
May 12 '07 #9
On May 12, 11:55 am, BartlebyScriven er <bscrivene...@g mail.comwrote:
I'm not sure how you installed Python, or how you are using it, but I
made something last year to help Windows XP users who are brand new to
Python and can't get things to run, etc.

You might try either jumping into somewhere midway, or if you keep
having trouble, uninstall whatever you installed and start over using
this:

http://www.richarddooling.com/index....on-on-xp-7-min...

If that link breaks, use this:

http://tinyurl.com/w7wgp

Good luck.

rd
That is one of my problems, I don't know exactly how the whole command
line thing works. The other day, I got it to open python by itself,
but I accidentally closed the window and couldn't get it to work
again. I know how to do file paths and stuff but I'm not sure what to
put directly after it says C:\Documents and Settings\HP_Own er>. Do I
leave it like that and then put the next location in the line? Like
this:
C:\Documents and Settings\HP_Own erPython 2.5.1\Python area.py
Or is that wrong. I've already uninstalled and reinstalled because I
couldn't copy and paste it to another location, so I just reinstalled
it to HP_Owner. I'll try that link.
Thanks.

May 13 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
2976
by: Chris Reedy | last post by:
For everyone - Apologies for the length of this message. If you don't want to look at the long example, you can skip to the end of the message. And for the Python gurus among you, if you can spare the time, I would appreciate any comments (including words like evil and disgusting, if you think they are applicable :-}) on the example here. Kenny -
9
2125
by: Roy Smith | last post by:
I'm working on a prototype of a new application in Python. At some point, if this ever turns into a product, the powers that be will almost certainly demand that it be done in Perl. My job will be to convince them otherwise. The basic design of the application is object oriented. I've never used Perl's OO features, so I'm not in a good position to make a comparison of the two languages from an OO point of view. Can somebody who's...
10
3077
by: Jeff Wagner | last post by:
I am in the process of learning Python (obsessively so). I've been through a few tutorials and read a Python book that was lent to me. I am now trying to put what I've learned to use by rewriting that Numerology program I wrote years ago in VB. There are times I am totally stuck (for instance, I just had an idea to put the numerical values of the alphabet and months of the year in a dictionary located in a function. Then, I can import the...
7
1631
by: has | last post by:
<BLUSH> Careless talk costs lives, as they say. In my case, a throwaway comment that Python could trounce the notoriously underpowered and undersupported AppleScript language for "serious number crunching". (And Perl could beat Python, and Fortran could kick all their butts, etc...) Well, you'd think me and the other guy would be old enough to know better, or at least have more important things to do, but nooooo... Ah well, too late...
7
7975
by: Steve Menard | last post by:
Here is my problem. I have this library thats hosts another language within python, and allows that language to call back INTO python. All is good as long as the other languages calls back on the same thread. If the callback arrives on a different thread, all hell break loose and the program dies horribly. looking at the C api documentation, I came upon the following block of
45
3005
by: Joh | last post by:
hello, i'm trying to understand how i could build following consecutive sets from a root one using generator : l = would like to produce : , , , ,
2
1495
by: Benji99 | last post by:
Hi guys, I'm starting to learn Python and so far am very impressed with it's possibilities. I do however need some help with certain things I'm trying to do which as of yet haven't managed to find the answer by myself. Hopefully, someone will be able to give me some pointers :) First my background, I haven't programmed seriously in over 5 years, but recently have started programming again in Delphi/Pascal scripting, and that's what I'm...
2
2141
by: Aaron | last post by:
I have a data sructure setup and I populate it in a loop like so: y=0 while X: DS.name = "ASDF" DS.ID = 1234 list = DS; y = y + 1
10
1432
by: blah | last post by:
i m currently in a network (LAN). i started python because i heard that it has great ability for networking programs and/or scripts, but i m losing my motivation with python because there are sooo many modules, that i cant just learn them all, this deters from c or c++ in which there are only a limited number of header files. what loses my interest is that if i cant learn these modules, and there are lots and lots of python modules, how...
14
5502
by: mistral | last post by:
Need compile python code, source is in html and starts with parameters: #!/bin/sh - "exec" "python" "-O" "$0" "$@" I have installed ActivePython for windows.
0
7862
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8228
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8357
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7987
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6634
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5398
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2372
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1459
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1196
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.