Skip to content

Instantly share code, notes, and snippets.

@mayankdawar
Created February 19, 2020 17:30
Show Gist options
  • Save mayankdawar/cb273d7969800a4991698268942f2f56 to your computer and use it in GitHub Desktop.
Save mayankdawar/cb273d7969800a4991698268942f2f56 to your computer and use it in GitHub Desktop.
Create one conditional to find whether “false” is in string str1. If so, assign variable output the string “False. You aren’t you?”. Check to see if “true” is in string str1 and if it is then assign “True! You are you!” to the variable output. If neither are in str1, assign “Neither true nor false!” to output.
str1 = "Today you are you! That is truer than true! There is no one alive who is you-er than you!"
if 'false' in str1:
output = "False. You aren't you?"
elif "true" in str1:
output = "True! You are you!"
else:
output = "Neither true nor false"
@jaishwaryabhushan
Copy link

output=''
str1 = "Today you are you! That is truer than true! There is no one alive who is you-er than you!"
if "true" in str1:
output+="True! You are you!"
elif "false" in str1:
output+="False. You aren’t you?"
else:
output+="Neither true nor false!"
print(output)

Copy link

ghost commented Jan 24, 2023

str1 = "Today you are you! That is truer than true! There is no one alive who is you-er than you!"

if "false" in str1:
output="False. You aren’t you?"
elif "true" in str1:
output="True! You are you!"
else:
output="Neither true nor false!"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment