python 学习之 Pig Latin
来源:互联网 发布:mysql 解锁 编辑:程序博客网 时间:2024/05/29 18:59
write a Pig Latin translator
Pig Latin is a language game, where you move the first letter of the word to the end and add “ay.” So python become ythonpay. just like this.
the code
print 'Welcome to the Pig Latin translator!'name = raw_input("Enter a word:")if len(name) > 0 and name.isalpha(): #method .isalpha()which returns False since the string contains non-letter characters word = name.lower() first = word[0] new_word = word + first new_word = new_word[1:len(new_word)] print name print first print new_wordelse: print "the name is empty"
3.the character
#create a variable a and give it the stirng "Simple"a = "Simple"#get the first letter of it using a[0]print a[0]# get the other letter,will print impprint a[1:4]
阅读全文
0 0
- python 学习之 Pig Latin
- Python学习——Pig Latin小游戏
- Pig Latin练习-python
- Python——Pig Latin
- Python 小练习 Pig Latin
- pig latin
- Pig Latin
- Pig Latin
- Pig Latin
- Pig Latin
- PIG LATIN分析报告
- UVa 492 - Pig-Latin
- PIG LATIN分析报告
- pig latin 简介
- Pig Latin示例
- Pig Latin关系操作
- Pig Latin数据类型
- Pig Latin 简单使用
- nagios(centos7.3环境) 的源码安装
- Java开发环境的搭建以及使用eclipse从头一步步创建java项目
- STL之set
- Codeforces Round #306 (Div. 2) A. Two Substrings string两个函数使用
- Hibernate中Session的load和get方法的区别是什么?
- python 学习之 Pig Latin
- 安装系统
- JavaScript深入系列15篇正式完结!
- Android开发:XML简介及DOM、SAX、PULL解析对比
- zcmu-1986
- js中问号
- 单表查询
- SDUT-3474 汤圆の拯救计划(常规BFS)
- 【数据平台】python中文分词工具jieba