In: Computer Science
Write a Python program that will ask the user to input a word, will return the first letter of the input word, and ask the user to put another word, and so on, in the form of a loop. If the user chooses to stop, he or she should input the integer "0" for the loop to stop.
Source Code:
Output:
Code in text format (See above images of code for indentation):
#variable to store word
word=""
#use loop and it iterates upto 0
while(word!='0'):
#read a word from user
word=input("Enter a word or 0 to exit: ")
#check for 0
if(word!='0'):
#print first letter of input word
print("The first letter of word is: ",word[0])