Question

PYTHON WITHOUT def function Given two inputs: a sentence and a word to be censored. Print...

PYTHON WITHOUT def function

Given two inputs: a sentence and a word to be censored. Print out a new sentence with the word censored. In place of the censored word, print "*******", where the number of * characters match the length of the word. The program should censor the exact casing of the word.

Sample Input

Pysics is very hard!I'm very ready! Im very excited

Sample Output

Pysics is **** hard!I'm **** ready! Im **** excited

Homework Answers

Answer #1

Python code:

#accepting sentence
sentence=input()
#accepting word
word=input()
#replacing the word in sentence with "*"
sentence=sentence.replace(word,"*"*len(word))
#printing changed sentence
print(sentence)

Screenshot:


Input and Output:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
PYTHON without def function Given two inputs: a sentence and a word to be censored. Print...
PYTHON without def function Given two inputs: a sentence and a word to be censored. Print out a new sentence with the word censored. In place of the censored word, print "*******", where the number of * characters match the length of the word. The program should censor the exact casing of the word. Sample Input Pysics is very hard!I'm very ready! Im very excited Sample Output Pysics is **** hard!I'm **** ready! Im **** excited
Write a program in python reverse each and every word of the sentence using function taking...
Write a program in python reverse each and every word of the sentence using function taking string as input parameter from user and passing that string into function and also explain the logic ======================================= input: 'Exam is gonna be good' output: 'maxE si annog eb doog' ================ i am trying like this but getting confused '.'join([w::-1] for w in s.split()]) i need more focus on explanations because it is making me confuse i am not clear with concepts so please...
Use Python 3.8: Problem Description Many recipes tend to be rather small, producing the fewest number...
Use Python 3.8: Problem Description Many recipes tend to be rather small, producing the fewest number of servings that are really possible with the included ingredients. Sometimes one will want to be able to scale those recipes upwards for serving larger groups. This program's task is to determine how much of each ingredient in a recipe will be required for a target party size. The first inputs to the program will be the recipe itself. Here is an example recipe...
Python: Simple Banking Application Project Solution: • Input file: The program starts with reading in all...
Python: Simple Banking Application Project Solution: • Input file: The program starts with reading in all user information from a given input file. The input file contains information of a user in following order: username, first name, last name, password, account number and account balance. Information is separated with ‘|’. o username is a unique information, so no two users will have same username. Sample input file: Username eaglebank has password 123456, account number of BB12 and balance of $1000....
**please write code with function definition taking in input and use given variable names** for e.g....
**please write code with function definition taking in input and use given variable names** for e.g. List matchNames(List inputNames, List secRecords) Java or Python Please Note:    * The function is expected to return a STRING_ARRAY.      * The function accepts following parameters:      *  1. STRING_ARRAY inputNames      *  2. STRING_ARRAY secRecords      */ Problem Statement Introduction Imagine you are helping the Security Exchange Commission (SEC) respond to anonymous tips. One of the biggest problems the team faces is handling the transcription of the companies reported...
Write a Python 3 program called “parse.py” using the template for a Python program that we...
Write a Python 3 program called “parse.py” using the template for a Python program that we covered in this module. Note: Use this mod7.txt input file. Name your output file “output.txt”. Build your program using a main function and at least one other function. Give your input and output file names as command line arguments. Your program will read the input file, and will output the following information to the output file as well as printing it to the screen:...