473,395 Members | 1,484 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 1221
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
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
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
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
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
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
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
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
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
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
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
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.