473,508 Members | 2,361 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Newb ?

Hello all,

Have a problem here with a challenge from a book I am reading.
Any help is much appreciated.

I am trying to run a program that asks the user for a statement and then
prints it out backwards.
this is what I have.
It does not print anything out. I assume that I have something out of whack
with my high and low statements.

Thanks for you help.
print "\n\nWelcome to the Backwards Message Display."
print
message = raw_input("\nPlease Enter a Message.")

high = len(message)
low = -len(message)
print
print message[high:low]
print
print raw_input("Please Press Enter to Exit")
Nov 22 '05 #1
14 1222
Chad Everett wrote:
Hello all,

Have a problem here with a challenge from a book I am reading.
Any help is much appreciated.

I am trying to run a program that asks the user for a statement and then
prints it out backwards.
this is what I have.
It does not print anything out. I assume that I have something out of whack
with my high and low statements.

Thanks for you help.
print "\n\nWelcome to the Backwards Message Display."
print
message = raw_input("\nPlease Enter a Message.")

high = len(message)
low = -len(message)
print
print message[high:low]
print
print raw_input("Please Press Enter to Exit")


Are you sure that this is not a class assignment? You can search the
messages here for the answer.
Nov 22 '05 #2
Chad Everett wrote:
Hello all,

Have a problem here with a challenge from a book I am reading.
Any help is much appreciated.

I am trying to run a program that asks the user for a statement and then
prints it out backwards.
this is what I have.
It does not print anything out. I assume that I have something out of whack
with my high and low statements.

Thanks for you help.
print "\n\nWelcome to the Backwards Message Display."
print
message = raw_input("\nPlease Enter a Message.")

high = len(message)
low = -len(message)
print
print message[high:low]
print
print raw_input("Please Press Enter to Exit")


Are you sure that this is not a class assignment? You can search the
messages here for the answer.
Nov 22 '05 #3

"Paul Watson" <pw*****@redlinepy.com> wrote in message
news:3t************@individual.net...
Chad Everett wrote:
Hello all,

Have a problem here with a challenge from a book I am reading.
Any help is much appreciated.

I am trying to run a program that asks the user for a statement and then
prints it out backwards.
this is what I have.
It does not print anything out. I assume that I have something out of
whack with my high and low statements.

Thanks for you help.
print "\n\nWelcome to the Backwards Message Display."
print
message = raw_input("\nPlease Enter a Message.")

high = len(message)
low = -len(message)
print
print message[high:low]
print
print raw_input("Please Press Enter to Exit")


Are you sure that this is not a class assignment? You can search the
messages here for the answer.


No, I have been out of school way too long. I am 34 trying to learn a new
trade. I searched the group for the term backwards but I did not get any
results.
Nov 22 '05 #4

"Paul Watson" <pw*****@redlinepy.com> wrote in message
news:3t************@individual.net...
Chad Everett wrote:
Hello all,

Have a problem here with a challenge from a book I am reading.
Any help is much appreciated.

I am trying to run a program that asks the user for a statement and then
prints it out backwards.
this is what I have.
It does not print anything out. I assume that I have something out of
whack with my high and low statements.

Thanks for you help.
print "\n\nWelcome to the Backwards Message Display."
print
message = raw_input("\nPlease Enter a Message.")

high = len(message)
low = -len(message)
print
print message[high:low]
print
print raw_input("Please Press Enter to Exit")


Are you sure that this is not a class assignment? You can search the
messages here for the answer.


No, I have been out of school way too long. I am 34 trying to learn a new
trade. I searched the group for the term backwards but I did not get any
results.
Nov 22 '05 #5
Chad Everett <ev*******@hotmail.com> wrote:
I searched the group for the term backwards but I did not get any
results.


You might have better results searching for 'reverse'.

--
\ "For certain people, after fifty, litigation takes the place of |
`\ sex." -- Gore Vidal |
_o__) |
Ben Finney
Nov 22 '05 #6
Chad Everett <ev*******@hotmail.com> wrote:
I searched the group for the term backwards but I did not get any
results.


You might have better results searching for 'reverse'.

--
\ "For certain people, after fifty, litigation takes the place of |
`\ sex." -- Gore Vidal |
_o__) |
Ben Finney
Nov 22 '05 #7
Chad Everett wrote:
"Paul Watson" <pw*****@redlinepy.com> wrote in message
news:3t************@individual.net...
Chad Everett wrote:
high = len(message)
low = -len(message)
print
print message[high:low]
print
print raw_input("Please Press Enter to Exit")


Are you sure that this is not a class assignment? You can search the
messages here for the answer.

No, I have been out of school way too long. I am 34 trying to learn a new
trade. I searched the group for the term backwards but I did not get any
results.


The problem is that negative numbers mean "count from the rightmost end
of the string or list." Also, you are going high to low without any
indication that you mean to go backwards.
message = raw_input("Enter a Message:")
print message[: : -1]


-Scott David Daniels
sc***********@acm.org
Nov 22 '05 #8
Chad Everett wrote:
"Paul Watson" <pw*****@redlinepy.com> wrote in message
news:3t************@individual.net...
Chad Everett wrote:
high = len(message)
low = -len(message)
print
print message[high:low]
print
print raw_input("Please Press Enter to Exit")


Are you sure that this is not a class assignment? You can search the
messages here for the answer.

No, I have been out of school way too long. I am 34 trying to learn a new
trade. I searched the group for the term backwards but I did not get any
results.


The problem is that negative numbers mean "count from the rightmost end
of the string or list." Also, you are going high to low without any
indication that you mean to go backwards.
message = raw_input("Enter a Message:")
print message[: : -1]


-Scott David Daniels
sc***********@acm.org
Nov 22 '05 #9
"Chad Everett" <ev*******@hotmail.com> writes:
print "\n\nWelcome to the Backwards Message Display."
print
message = raw_input("\nPlease Enter a Message.")


Since you said it wasn't a school assignment, and I'm a trusting soul,
the next line could be:

print message[::-1]

<mike

--
Mike Meyer <mw*@mired.org> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Nov 22 '05 #10
"Chad Everett" <ev*******@hotmail.com> writes:
print "\n\nWelcome to the Backwards Message Display."
print
message = raw_input("\nPlease Enter a Message.")


Since you said it wasn't a school assignment, and I'm a trusting soul,
the next line could be:

print message[::-1]

<mike

--
Mike Meyer <mw*@mired.org> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Nov 22 '05 #11
Hey guys,

Thanks for the hint.
I found that info last night but I could never get it to print more than
just the last letter.
or it would only print partially.
I was using just a single colon, the double colon did it.

Thanks

"Chad Everett" <ev*******@hotmail.com> wrote in message
news:f1*******************@bignews7.bellsouth.net. ..
Hello all,

Have a problem here with a challenge from a book I am reading.
Any help is much appreciated.

I am trying to run a program that asks the user for a statement and then
prints it out backwards.
this is what I have.
It does not print anything out. I assume that I have something out of
whack with my high and low statements.

Thanks for you help.
print "\n\nWelcome to the Backwards Message Display."
print
message = raw_input("\nPlease Enter a Message.")

high = len(message)
low = -len(message)
print
print message[high:low]
print
print raw_input("Please Press Enter to Exit")

Nov 22 '05 #12
Hey guys,

Thanks for the hint.
I found that info last night but I could never get it to print more than
just the last letter.
or it would only print partially.
I was using just a single colon, the double colon did it.

Thanks

"Chad Everett" <ev*******@hotmail.com> wrote in message
news:f1*******************@bignews7.bellsouth.net. ..
Hello all,

Have a problem here with a challenge from a book I am reading.
Any help is much appreciated.

I am trying to run a program that asks the user for a statement and then
prints it out backwards.
this is what I have.
It does not print anything out. I assume that I have something out of
whack with my high and low statements.

Thanks for you help.
print "\n\nWelcome to the Backwards Message Display."
print
message = raw_input("\nPlease Enter a Message.")

high = len(message)
low = -len(message)
print
print message[high:low]
print
print raw_input("Please Press Enter to Exit")

Nov 22 '05 #13
Chad Everett wrote:
Hey guys,

Thanks for the hint.
I found that info last night but I could never get it to print more than
just the last letter.
or it would only print partially.
I was using just a single colon, the double colon did it.


If you were using a single colon, then it would print everything except
the last character. Use the Python interactive mode for experimentation.

$ python
Python 2.4.1 (#1, Jul 19 2005, 14:16:43)
[GCC 4.0.0 20050519 (Red Hat 4.0.0-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
s = 'abc'
s 'abc' s[:-1] 'ab' s[-1]

'c'
Nov 22 '05 #14
Chad Everett wrote:
Hey guys,

Thanks for the hint.
I found that info last night but I could never get it to print more than
just the last letter.
or it would only print partially.
I was using just a single colon, the double colon did it.


If you were using a single colon, then it would print everything except
the last character. Use the Python interactive mode for experimentation.

$ python
Python 2.4.1 (#1, Jul 19 2005, 14:16:43)
[GCC 4.0.0 20050519 (Red Hat 4.0.0-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
s = 'abc'
s 'abc' s[:-1] 'ab' s[-1]

'c'
Nov 22 '05 #15

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

Similar topics

0
2112
by: claudel | last post by:
Hi I have a newb PHP/Javascript question regarding checkbox processing I'm not sure which area it falls into so I crossposted to comp.lang.php and comp.lang.javascript. I'm trying to...
4
28432
by: Hari | last post by:
Basically I would like to downlod the visual basic 6.0 compiler, but i already have the vb.net compiler. I had to pay for the VB.net IDE, just wondering if I can get the vb 6.0 IDE for free or not....
0
1633
by: David E. | last post by:
So as a programmer, what's the best thing to study? EJB? How much of the J2EE or Enterprise architecture is necessary to no? I guess I need a good overview for a newb like me... thanks.. --...
5
2019
by: Alexandre | last post by:
Hi, Im a newb to dev and python... my first sefl assigned mission was to read a pickled file containing a list with DB like data and convert this to MySQL... So i wrote my first module which...
3
1735
by: Walter | last post by:
But I'm stumped..... I've got a windows 2000 server and I am trying to set up PHPBB on it using a mysql database.. I am very inexperienced on this..... Ive installed mysql V4.0.20d and I can...
3
1816
by: claudel | last post by:
Hi I have a newb PHP/Javascript question regarding checkbox processing I'm not sure which area it falls into so I crossposted to comp.lang.php and comp.lang.javascript. I'm trying to...
1
1542
by: notbob | last post by:
Newb here! Using 4.0.20 on Slack. Slogging through the official manual. At 2.4.3 Securing the Initial MySQL Accounts, I'm finally stopped cold while trying to follow instructions. Here's what I...
4
1429
by: Donald Newcomb | last post by:
I'm a real Python NEWB and am intrigued by some of Python's features, so I'm starting to write code to do some things to see how it works. So far I really like the lists and dictionaries since I...
6
1669
by: Sean Berry | last post by:
Hello all I have build a list that contains data in the form below -- simplified for question -- myList = ,, ...] I have a function which takes value3 from the lists above and returns...
11
1970
by: The_Kingpin | last post by:
Hi all, I'm new to C programming and looking for some help. I have a homework project to do and could use every tips, advises, code sample and references I can get. Here's what I need to do....
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7115
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...
0
7321
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,...
0
7377
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...
1
7036
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...
0
5624
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,...
1
5047
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4705
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...
0
414
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...

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.