回文 [英] Palindrome

查看:80
本文介绍了回文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道我如何解决我的Palindrome计划?


s = raw_input(''输入字符串:'')

标点符号='' %$ *, - !:? ;()\''\" \\''

i = 0

h = 0

t = 0
p =''''

z = 0

而s!='''':

而i< = len(s) - 1:

punct = s [i]

如果punctuation.find(punct)== -1:

p = p + punct

i = i + 1

t = p.lower()

t [h] == t [len(t)-1 -h]

解决方案

!*。, - :? ;()\''\" \\''

i = 0

h = 0

t = 0
p =''''

z = 0

而s!='''':

而i< = len(s) - 1:

punct = s [i]

如果punctuation.find(punct)== -1:

p = p + punct

i = i + 1

t = p.lower()

t [h] == t [len(t)-1 -h]


2003年11月13日格林尼治标准时间03:31:35,Runic911写道:

有谁知道如何修复我的Palindrome程序?

我= 0
我= =
>

您可以从使用助记符变量名开始。这些算法使得

算法成为一件苦差事。当你这样做的时候随意重新发布它。


-

\我相信让世界变得安全孩子们,但不是,孩子们的孩子,因为我不认为孩子应该发生性行为。 - Jack Handey |

Ben Finney< http://bignose.squidly.org/>


知道你的程序应该做什么,也可以帮忙。

G-:


" Runic911" < RU ****** @ aol.com>在留言新闻中写道:20 *************************** @ mb-m12.aol.com ...

|有谁知道我如何解决我的Palindrome计划?

|

| s = raw_input(''输入字符串:'')

|标点符号=''%


Does anyone know how i can fix my Palindrome program?

s = raw_input(''Enter a String: '')
punctuation = ''%$!*.,-:? ;()\''\"\\''
i = 0
h = 0
t = 0
p = ''''
z = 0
while s!= '' '':
while i <= len(s) - 1:
punct = s[i]
if punctuation.find(punct) == -1:
p = p + punct
i = i + 1
t = p.lower()
t[h] == t[len(t)-1-h]

解决方案

!*.,-:? ;()\''\"\\''
i = 0
h = 0
t = 0
p = ''''
z = 0
while s!= '' '':
while i <= len(s) - 1:
punct = s[i]
if punctuation.find(punct) == -1:
p = p + punct
i = i + 1
t = p.lower()
t[h] == t[len(t)-1-h]


On 13 Nov 2003 03:31:35 GMT, Runic911 wrote:

Does anyone know how i can fix my Palindrome program?

i = 0
h = 0
t = 0
p = ''''
z = 0



You can start by using mnemonic variable names. These ones make the
algorithm a chore to read. Feel free to re-post it when you''ve done so.

--
\ "I believe in making the world safe for our children, but not |
`\ our children''s children, because I don''t think children should |
_o__) be having sex." -- Jack Handey |
Ben Finney <http://bignose.squidly.org/>


Knowing what your program should do, could also help.
G-:

"Runic911" <ru******@aol.com> wrote in message news:20***************************@mb-m12.aol.com...
| Does anyone know how i can fix my Palindrome program?
|
| s = raw_input(''Enter a String: '')
| punctuation = ''%


这篇关于回文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆