diff --git a/Images/practice5.py.jpg b/Images/practice5.py.jpg new file mode 100644 index 0000000..3de1008 Binary files /dev/null and b/Images/practice5.py.jpg differ diff --git a/README.md b/README.md index 7114c57..38501c4 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ | 1 | [Code](practice1.py) | [Output](Images/1.png) | 24 | [Code](practice24.py) | [Output Not Available]() | 27 | [Code](practice27.py) | [Output](Images/27.png) +| 5 | [Code](practice5.py) | [Output](Images/practice5.py.jpg) ------------------------------------------------------ ## Requirements: diff --git a/practice5.py b/practice5.py new file mode 100644 index 0000000..5d69730 --- /dev/null +++ b/practice5.py @@ -0,0 +1,15 @@ +''' Pig Latin problem +1) If the word begins with a vowel (a, e, i, o, or u), add “way” to the end of the +word. So “air” becomes “airway” and “eat” becomes “eatway.” +2) If the word begins with any other letter, then we take the first letter, put it on +the end of the word, and then add “ay.” Thus, “python” becomes “ythonpay” +and “computer” becomes “omputercay.” ''' + +def pig_latin(a): + if a[0] in 'aeiou': + return a+'way' + else: + return a[1:]+a[0]+'ay' + +print(pig_latin(input("Enter any string p.s first letter should not be capital :"))) +