Q. Write a program that inputs a tuple having words of a string as its elements e.g., ("The", "quick", "brown", "fox") and then translates each text element to Pig Latin.
[English is translated to Pig Latin by taking the first letter of every word, moving it to the end of the word and adding "ay". "The quick brown fox" becomes "Hetay uickqay rownbay oxfay".]
Answer =
tup = eval(input("Enter a tuple :- ")) index = 0 while index < len(tup): new = tup[ index ][1 : ] + tup[ index ][ 0 ] + "ay" print (new, end = " ") index += 1
this program does not work
ReplyDeleteit should be changed a bit to be
string= input("enter text")
tup=tuple(string.split())
index = 0
while index < len(tup):
new = tup[ index ][1 : ] + tup[ index ][ 0 ] + "ay"
print(new,end=" ")
index += 1
print()
nah its working
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )