Skip to content

Commit 30e953a

Browse files
Practice5.py and updates (#12)
* Added practice5.py Added Example 5 : Pig Latin problem * Added Output Output for practice5.py * Added new row Added new row for practice5 * Updated Output Image * Removed name Co-authored-by: looping <[email protected]>
1 parent 5ce0dff commit 30e953a

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

Images/practice5.py.jpg

65.8 KB
Loading

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
| 1 | [Code](practice1.py) | [Output](Images/1.png)
1313
| 24 | [Code](practice24.py) | [Output Not Available]()
1414
| 27 | [Code](practice27.py) | [Output](Images/27.png)
15+
| 5 | [Code](practice5.py) | [Output](Images/practice5.py.jpg)
1516
------------------------------------------------------
1617
## Requirements:
1718

practice5.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
''' Pig Latin problem
2+
1) If the word begins with a vowel (a, e, i, o, or u), add “way” to the end of the
3+
word. So “air” becomes “airway” and “eat” becomes “eatway.”
4+
2) If the word begins with any other letter, then we take the first letter, put it on
5+
the end of the word, and then add “ay.” Thus, “python” becomes “ythonpay”
6+
and “computer” becomes “omputercay.” '''
7+
8+
def pig_latin(a):
9+
if a[0] in 'aeiou':
10+
return a+'way'
11+
else:
12+
return a[1:]+a[0]+'ay'
13+
14+
print(pig_latin(input("Enter any string p.s first letter should not be capital :")))
15+

0 commit comments

Comments
 (0)