Journaling Quote Generator

Hey Everyone,

I am fairly new to coding and learning python. I am trying to learn concepts by making projects with them. The concept of this small project is to get a random journal quote when prompted by the user.
I am having 3 specific issues that I need help with or guidance on how to accomplish.

  1. When the options are displayed is there a way to still read the options regardless of the options being spelled as upper or lowercase? I attempt to use .upper however I don’t think that is correct

  2. When the code runs, I would like it to run until the user says “No” - how can I made it loop it again, I thought of making it a function but I am not good at understanding how to build one with the code I have

  3. Similar to issue 1, I would like to have the code read in different variations of the Yes or No regardless of its casing
    if response == "Yes" or response == "Y": and elif response == "No" or response == "N": For example with the user types in yes all lowercase it would still recognize it and run a quote same goes with “no or n” - for this one I attempted the .lower again and got an error and didn’t know how else to have the code read it

Appreciate everyone that can help!

import random 

love_relationships_quotes = [ "What do you value most in relationships (trust, respect, sense of humor, etc.)", "What three important things have you learned from previous relationships?", "What are three things working well in your current relationship? What are three things that could be better?"

self_reflection_quotes = [ "What values do you consider most important in life (honesty, justice, altruism, loyalty, etc.)? How do your actions align with those values?", "Describe one or two significant life events that helped shape you into who you are today.?", "When do you trust yourself most? When do you find it harder to have faith in your instincts?"

uncomfortable_emotions_quotes = [ "What difficult thoughts or emotions come up most frequently for you?", "What do you fear most? Have your fears changed throughout life?", "What parts of daily life cause stress, frustration, or sadness? What can you do to change those experiences? "

newquote = input("Welcome to the journaling life. There are several subject for journal prompts, please select from the following: Love, Self or Emotions. Type your response to get started! \n")
if newquote == "Love":
  value = random.choice(love_relationships_quotes)
  print("This is your quote for today: " + value)
elif newquote == "Self":
  value = random.choice(self_reflection_quotes)
  print("This is your quote for today: " + value)
elif newquote == "Emotions":
  value = random.choice(uncomfortable_emotions_quotes)
  print("This is your quote for today: " + value)
  print("Invalid Input")

response = input("Would you like another quote? Y/N ] \n")
if response == "Yes" or response == "Y":
  print("Select from the following prompts: Love, Self or Emotions.")
elif response == "No" or response == "N": 
  print("We hope to see you soon!")
  print("Invalid Input")

Have you tried comparing the answer like:

if newquote.lower() == “love”:
I think that this would fix all the possibilities

To start the process again, I think you can put in a while loop, like this:

cont = “y”
while cont == “y”:
do stuff
cont = input("would you like another quote? y/n ")
print(“we hope to see you soon”)

1 Like

When I add in if newquote.lower() == “love”: it gives me invalid input I think because it’s reading it as such.