Python Forum
PigLatin Sentence Translator Help
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PigLatin Sentence Translator Help
#5
Im not sure if I did it right but its still not working.

def pig():
	
	sentence = input("Enter a sentence: ")
	
	
	for word in sentence.split():
	
		first_letter = word[0]
		
		newlist = []
	
		if first_letter in "aeiou":
		
			word = word + "ay"
			
			newlist.append(word)
		else:
		
			word = word[1:] + first_letter + "ay"
			
			newlist.append(word)

	newsent = (" ".join(newlist))
	print(newsent)
	

pig()
Reply


Messages In This Thread
PigLatin Sentence Translator Help - by 2skywalkers - Jun-22-2018, 09:32 PM
RE: PigLatin Sentence Translator Help - by 2skywalkers - Jun-22-2018, 10:37 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  (python) Can i get some help fixing a English to Morse translator? Pls AlexPython 7 1,631 Sep-12-2022, 02:55 AM
Last Post: AlexPython
  while sentence kimyyya 3 2,967 Mar-20-2021, 06:00 AM
Last Post: Pedroski55
  i want to write symbole as varibales in python to make translator rachidel07 9 3,550 Feb-03-2021, 09:57 PM
Last Post: nilamo
  List / arrays putting in sentence Kurta 3 2,584 Dec-25-2020, 11:29 AM
Last Post: Larz60+
  How to make a telegram bot respond to the specific word in a sentence? Metodolog 2 6,390 Dec-22-2020, 07:30 AM
Last Post: martabassof
  How to match partial sentence in long sentence Mekala 1 1,537 Jul-22-2020, 02:21 PM
Last Post: perfringo
  letter translator (or someting) Obsilion 4 2,473 Apr-28-2020, 12:40 PM
Last Post: deanhystad
  Remove a sentence if it contains a word. lokhtar 6 5,951 Feb-11-2020, 04:43 PM
Last Post: stullis
  I want to filter out words with one letter in a string (pig latin translator) po0te 1 2,124 Jan-08-2020, 08:02 AM
Last Post: perfringo
  Regex Help for clubbing similar sentence segments regstuff 3 2,170 Nov-20-2019, 06:46 AM
Last Post: perfringo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020