Computer Science, asked by anubhaviaankhen621, 10 months ago

3.4 Code Practice: Question 1 Input a word. If it is "yellow" print "Correct", otherwise print "Nope". What happens if you type in YELLOW? YellOW? Does the capitalizing make a difference?
can anyone write this in Python?

Answers

Answered by Chiavang20
12

Answer:

Here you go

Explanation:

import time

# Input yellow #

yellow = input("Enter yellow: ")

# If yellow #

if yellow == "yellow":

 print("Correct")

else:

 print("Nope")

Answered by AskewTronics
4

The python code for the above question is as follows:

Explanation:

color = input("Enter the value \"yellow\": ")# render a message to enter the value by user inputs. and store the value on color variable.

if (color == 'yellow'):  # compare the value of color variable with 'yellow'.

   print('Correct')  # it will executes, if the "if" statement is true.

else:

   print('Nope') # it will executes, if the "if" statement is false.

Output:

  • If the user inputs is 'yellow' it will print correct.
  • If the user inputs 'YELLOW' it will print nope.
  • If the user inputs  'YellOW', it will also print nope.

It is because capitalizing makes the difference between yellow and YELLOW or YellOW.

Code Explanation:

  • The first statement of the above code renders a message to enter 'yellow' and take the value from the user and store it on a color variable.
  • Then the color value is checked that it is yellow or not if true correct will print otherwise nope will print.

Learn More:

  • Python program : https://brainly.in/question/11062269
Similar questions