Write a Python 3 program which asks the user to enter a sentence which contains the same word several times, e.g. Monday is a nice day and on Monday I will talk to my students about Monday.
The program then asks the user to enter a word: e.g. Monday, then they are asked to enter another word, e.g. Friday.
Every occurrence of the first word entered should be replaced by the second word entered in the original sentence entered. In this example the output should be:
Friday is a nice day and on Friday I will talk to my students about Friday.
Thank you!
text = input("Enter a sentence: ")
old = input("Enter a word: ")
new = input("Enter another word to replace: ")
result = ''
i = 0
while i < len(text):
if text[i:].startswith(old):
result += new
i += len(old) - 1
else:
result += text[i]
i += 1
print(result)

Write a Python 3 program which asks the user to enter a sentence which contains the...
USING PYTHON PROGRAMING LANGUAGE Write a program that first asks the user to enter a “special” letter. The program should then ask the user to enter a single line sentence containing all lowercase letters and no punctuation, except for a period at the end. The program will then output the number of times that this letter appears in the sentence. Example: Enter a special letter: t Enter a sentence: here is my little sentence. Your letter appears 3 times. (t...
Write a program in python that asks the user to input a sentence. The program will ask the user what two letters are to be counted. You must use a “for” loop to go through the sentence & count how many times the chosen letter appears in the sentence. You are not allowed to use python built-in function "count()" or you'll get a Zero! Output will show the sentence, the letter, and the number of times the letter appears in...
Write a python program that does the following. a. It asks the user to enter a 5-digit integer value, n. b. The program reads a value entered by the user. If the value is not in the right range, the program should terminate. c. The program calculates and stores the 5 individual digits of n. d. The program outputs a “bar code” made of 5 lines of stars that represent the digits of the number n. For example, the following...
1. Day of the Week Write a program that asks the user for a number in the range of 1 through 7. The program should display the corresponding day of the week, where 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday, and 7 = Sunday. The program should display an error message if the user enters a number that is outside the range of 1 through 7. (On PYTHON IDLE...
23. Personal Weeb Page GeneratorWrite a program that asks the user for his or her name, and then asks the user to enter a sentence that describes him or herself. Here is an example of the program's screen:Enter your name: Julie Taylor [Enter]<html> <head> </head> <body> <center> <h1>Julie Taylor</h1> </center> <hr /> I am a computer science major, a member of the Jazz club, and I hope to work as a mobile app developer after I graduate. <hr /> </body> </html>Describe yourself: I am a computer science major, a member of theOnce the user has entered the requested input, the program should create an HTML file,...
Write a program that asks the user to enter a string and then asks the user to enter a character. The program should count and display the number of times that the specified character appears in the string. python programming
Python Write a program which asks the user keep inputting values on a line followed by enter until they enter a blank line, at which point the program should print the number of lines entered (excluding the blank).
Python Programming
Q.3) Write a program that repeatedly asks the user to enter words until they enter a period ("."). Your program should then print all of the words they entered including the period) on a single line separated by spaces. For example, Enter some words (. to stop): > hello > world hello world.
Python 3: Write a program in python that asks the user to enter a number that contains 4 digits, i.e. in the range [1000-9999]. Your program MUST take it as a number integer. Print each digit on a separate line.
write in python idle Write a full python program that asks the user to type in 10 words using a loop, prompting the user for each word with a number. The program then displays the longest word and the shortest word the user typed in.