Question

In: Computer Science

Print "Censored" if userInput contains "darn", else print iserInput. End with newline. Ex: If userInput is...

Print "Censored" if userInput contains "darn", else print iserInput. End with newline. Ex: If userInput is "That darn cat", then output is:

Solutions

Expert Solution

CODE IN PYTHON:

userInput = input("Enter the input:")
if "darn" in userInput.lower():
    print("Censored")
else:
    print(userInput)

INDENTATION:

OUTPUT:


Related Solutions

Print "Censored" if userInput contains the word "darn", else print userInput. End with newline. Ex: If...
Print "Censored" if userInput contains the word "darn", else print userInput. End with newline. Ex: If userInput is "That darn cat.", then output is: Censored Ex: If userInput is "Dang, that was scary!", then output is: Dang, that was scary! Note: If the submitted code has an out-of-range access, the system will stop running the code after a few seconds, and report "Program end never reached." The system doesn't print the test case that caused the reported message. #include <iostream>...
Print "Censored" if userInput contains the word "darn", else print userInput. End with newline. Note: These...
Print "Censored" if userInput contains the word "darn", else print userInput. End with newline. Note: These activities may test code with different test values. This activity will perform three tests, with userInput of "That darn cat.", then with "Dang, that was scary!", then with "I'm darning your socks.". See "How to Use zyBooks". . Also note: If the submitted code has an out-of-range access, the system will stop running the code after a few seconds, and report "Program end never...
(Java Zybooks) Print "Censored" if userInput contains the word "darn", else print userInput. End with newline....
(Java Zybooks) Print "Censored" if userInput contains the word "darn", else print userInput. End with newline. Ex: If userInput is "That darn cat.", then output is: Censored Ex: If userInput is "Dang, that was scary!", then output is: Dang, that was scary! Note: If the submitted code has an out-of-range access, the system will stop running the code after a few seconds, and report "Program end never reached." The system doesn't print the test case that caused the reported message....
Print either "Fruit", "Drink", or "Unknown" (followed by a newline) depending on the value of userItem....
Print either "Fruit", "Drink", or "Unknown" (followed by a newline) depending on the value of userItem. Print "Unknown" (followed by a newline) if the value of userItem does not match any of the defined options. For example, if userItem is GR_APPLES, output should be: Fruit #include <stdio.h> int main(void) { enum GroceryItem {GR_APPLES, GR_BANANAS, GR_JUICE, GR_WATER}; enum GroceryItem userItem = GR_APPLES; /* Your solution goes here */ return 0; } USE C PLEASE
X=5,Y=7,Z=10 A. if(X<Y): print "LESS" else: print "OTHER" B. if (x == 1): print "ONE" elif...
X=5,Y=7,Z=10 A. if(X<Y): print "LESS" else: print "OTHER" B. if (x == 1): print "ONE" elif (x == 2): print "TWO" elif (x == 3): print "THREE" elif (x == 4): print "FOUR" elif (x == 5): print "FIVE" elif (x == 6): print "SIX" else: print "OTHER" C. if (X<Z): print X X = X + 1 D. while (X<Z): print X X = X + 1 Q11. What is the final value of X in D Q12. Is...
Print all subset sums of a given array recursively and iteratively. ex) if the input is...
Print all subset sums of a given array recursively and iteratively. ex) if the input is {1, 2, 3}, it should return {0,1,2,3,3,4,5,6}. public int[] subsetSum1(int[] arr) { *recursive*} public int[] subsetSum2(int[] arr) {*iterative*}
pyramid.py program for i in range(1,6): for j in range(i): print("*",end=' ') print("\n",end='') Exercise: Create the...
pyramid.py program for i in range(1,6): for j in range(i): print("*",end=' ') print("\n",end='') Exercise: Create the pyramid similar to the above pyramid.py program using a while loop. Name your program whilepyramid.py and submit it on blackboard.
Write an if-else statement with multiple branches. If givenYear is 2101 or greater, print "Distant future"...
Write an if-else statement with multiple branches. If givenYear is 2101 or greater, print "Distant future" (without quotes). Else, if givenYear is 2001 or greater (2001-2100), print "21st century". Else, if givenYear is 1901 or greater (1901-2000), print "20th century". Else (1900 or earlier), print "Long ago". Do NOT end with newline C++
The third worksheet ("Ex. 3") contains 2 4x4 matrices, plus space for a third. Write a...
The third worksheet ("Ex. 3") contains 2 4x4 matrices, plus space for a third. Write a program that will read the first 2 matrices into array "B" and "C" . Create a 3rd array, "A" that is the result of matrix B + matrix C (i.e |A| = |B| + |C|). Output that array in the indicated cells (upper left = cell K1) To do this, use the rule for array addition for each matrix element: aij = bij +...
import random #the menu function def menu(list, question): for entry in list: print(1 + list.index(entry),end="") print(")...
import random #the menu function def menu(list, question): for entry in list: print(1 + list.index(entry),end="") print(") " + entry) return int(input(question)) plz explain this code
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT