Lesson 59
This commit is contained in:
		
							parent
							
								
									197a64869d
								
							
						
					
					
						commit
						64b582fa6f
					
				
							
								
								
									
										25
									
								
								basics.py
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								basics.py
									
									
									
									
									
								
							@ -1,7 +1,18 @@
 | 
			
		||||
output = ""
 | 
			
		||||
something = ""
 | 
			
		||||
while something != "\end":
 | 
			
		||||
    something = input("Say something: ")
 | 
			
		||||
    if something != "\end":
 | 
			
		||||
        output = output + something + ". "
 | 
			
		||||
print(output)
 | 
			
		||||
def sentence_maker(phrase):
 | 
			
		||||
    interrogatives = ("how", "what", "why")
 | 
			
		||||
    capitalized = phrase.capitalize()
 | 
			
		||||
    if phrase.startswith(interrogatives):
 | 
			
		||||
        return "{}?".format(capitalized)
 | 
			
		||||
    else:
 | 
			
		||||
        return "{}.".format(capitalized)
 | 
			
		||||
 | 
			
		||||
results = []
 | 
			
		||||
while True:
 | 
			
		||||
    user_input = input("Say something: ")
 | 
			
		||||
    if user_input == "\end":
 | 
			
		||||
        break
 | 
			
		||||
    else:
 | 
			
		||||
        results.append(sentence_maker(user_input))
 | 
			
		||||
 | 
			
		||||
print(" ".join(results))
 | 
			
		||||
    
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user