Day 008 - Project 8 : Affirmations (or insults) Generator

If you have any questions, comments or issues with this project please post them here!

2 posts were split to a new topic: Type error when printing a string and variable

Hello, I am working on day 8 and below is the start of my code:

print('Hello, welcome to this page')
name = input('Name? ')
print('Hello', name)

It keeps returning the following error:

Traceback (most recent call last):
  File "main.py", line 3, in <module>
    print(name)
TypeError: 'str' object is not callable

I tried changing name to to name1,name2,etcā€¦ and I am still facing the same issue. Can anyone help?

Hey @Tmanlearns welcome to the forums.

Itā€™s because you need to use the same kind of quotes. Both need to be " or ' and canā€™t be mixed and matched

Thank you for pointing that out! I fixed it and I am still facing the same issue, do you have any idea on what could be wrong?

Hi @Tmanlearns can you please post a link to your Repl so the community can see the error message and suggest some ideas?

Thank you @IanAtCSTeach @not-ethan . I solved the issue by deleting the work file(that is main.py) and creating a new one. Is there a way to mark this as solved?

1 Like

Thatā€™s ok @Tmanlearns this is a thread for any issues with Day 8. No need to mark as solved.

please help me with this.
I am new to the coding business and i need some help

Hey @himateja_yarlagadda welcome to the forums.

The problem is that you did not end the string or the print statement. To do this add ") at the end of the line.

2 Likes

Hi,
I got stuck in the challenge 8. I wrote all my statement and my condition. It doesnā€™t go inside of the statement.
https://replit.com/@Bea2022/day-8-100-days#main.py
Can you help me?

Hi @Bea2022 thanks for your question.

I think the issue might be with the following section of code:

if day == "monday":
    print(biginning+start + monday+close)
elif day == "tuesday":
    print(biginning+start + tuesday+close)
elif day == "wenesday":
    print(biginning+start + wenesday+close)
elif day == "thurday":
    print(biginning+start + thurday+close)
elif day == "friday":
    print(biginning+start + friday+close)
elif day == "saturday":
    print(biginning+start + saturday+close)
elif day == "sunday":
    print(biginning+start + sunday+close)
else:
    "what day is today!\nYou need to introduce the wright name of the day"

The day you type in must be EXACTLY the same as the options in the ifā€¦elifā€¦else section of code, wednesday and thursday have a slight typo in the code shown above.

You also need to add a print to the last line of code, e.g.

print( "what day is today!\nYou need to introduce the wright name of the day")

Hope this helps!

1 Like

Good shout, with the spelling and the missing print.

Thank you for being here!

2 Likes

Guys can you help me pls to make mood working from 1ā€¦ to 6 ? Plss ā€¦ and tks for your time .

print("God day sir-(mam) . I hope you will have a great day !")
print()
name = input("What is your name ? :  ")
if name == "Jhon" or name == "jhon":
  print("Hello Jhon . God morning !")
else:
  print("Hello . God morning sir - (mam)")
mood = input("Can you rate from 1 to 10 how god your day is ? :")
if mood ==  "1 + 2 + 3 + 4 + 5 + 6" : 
  print("Hope later you will ok !")
else:
  print("Nice to hear that . God day !")
day = input("What day of the week it is ? :  ")
if day == "monday" or day == "Monday":
  print("Today will go to Library !")
elif day == "tuesday" or day == "Tuesday":
    print("Today will go to Market !")
elif day == "wenesday" or day == "Wenesday":
    print("Today will go to Mouvie !")
elif day == "thurday" or day == "Thurday":
    print("Today will go to Shoping at the Mall !")
elif day == "friday" or day == "Frayday":
    print("Today will go to Museum !")
elif day == "saturday" or day == "Saturday":
    print("Today will go to Pitza and after to Cofetaria ")
elif day == "sunday" or day == "Sunday":
    print("Today you will choose what you wana to do !")
else:
    "Did you forget what day is ?"

Hey @Salladin welcome to the forums!

When you do if mood == "1 + 2 + 3 + 4 + 5 + 6" it checks if the var mood has the value of 1 + 2 + 3 + 4 + 5 + 6. To check the value of mood against 1, 2, 3 and so on you would use the Or operator. Here is an example

if mood == "1" Or mood == "2"
2 Likes

aaaa :)))) Super Tks . you are great :hugs: ā€¦ coudnt getit right . TKS

1 Like

Sending out good vibes :sunglasses: with the affirmation generator!

https://replit.com/@JackAdem/Day-008-Project-8-Affirmations-or-insults-Generator?v=1

Day 8 of #Replit100DaysOfCode #100DaysOfCode.

1 Like

Question:

Can someone please review my code for Day8 of the ā€œ100 Days of code - The Complete Python Courseā€?
Thank you!

  1. I donā€™t know if this is right and am not sure if there is anyway I can use AI to be my assignment grader. Is there a feature in replit like that?

  2. In my code, am I using nested If statements? My understanding is that I am not.

Repl link: https://replit.com/@vthtvt/day8100days?v=1

# Collect Personal Info
print("Let's collect some information!\n")

name = input("What is your name?\n")

fav_athlete = input("Who is your favorite athlete?\n")

fav_superhero = input("Who is your favorite superhero?\n")

fav_hobby = input("What's your favorite hobby?\n")

fav_city = input("What's your favorite city?\n")

# Day of the week
day = input("What day of the week is it today?\n")

# Daily Affirmation Generator

if day == "Monday" or day == "M" or day == "m" or day == "monday" or day == "Mon" or day == "mon":
  print(
    "Rise and shine,", name,
    "It's a brand new day and you have the power to make it amazing, go do epic shit."
  )

elif day == "Tuesday" or day == "T" or day == "t" or day == "tuesday" or day == "Tue" or day == "tue":
  print(
    "Like", fav_athlete,
    "you have the strength and determination to conquer any challenge that comes your way. Believe in yourself and keep pushing forward."
  )

elif day == "Wednesday" or day == "W" or day == "w" or day == "wednesday" or day == "Wed" or day == "wed":
  print(
    "Just like how", fav_superhero,
    "uses their unique abilities to make the world a better place, you too have unique talents and qualities that make you extraordinary. Embrace them and shine today!"
  )

elif day == "Thursday" or day == "Th" or day == "th" or day == "thursday" or day == "Thur" or day == "thur":
  print(
    "Take some time today to indulge in your favorite hobby,", fav_hobby,
    ", and let it bring you peace and joy. Remember to prioritize self-care and nurture your passions"
  )

elif day == "Friday" or day == "F" or day == "f" or day == "friday" or day == "Fri" or day == "fri":
  print("Close your eyes and envision yourself exploring the hidden gems of",
        fav_city,
        ", and let that excitement and wanderlust guide you through the day.")

elif day == "Saturday" or day == "saturday" or day == "Sat" or day == "sat":
  print(
    "Life is a journey and today is a new chapter. Embrace every moment and let them shape you into the amazing person you are meant to be,",
    name)

elif day == "Sunday" or day == "sunday" or day == "Sun" or day == "sun":
  print(
    "Remember that you have the power to manifest your dreams into reality, just like how ",
    fav_athlete, "and", fav_superhero,
    "turned their visions into accomplishments. Believe in yourself and make it happen."
  )

else:
  print("Make sure you are not inventing a new day šŸ˜‰")

@vthtvt

I hope this doesnā€™t mean school assignment. Given that itā€™s 100 days of code I think that is unlikely. EDIT: Received confirmation that this is not a school assignment.

  1. Try Ghostwriter. Thereā€™s a 7-day free trial followed by like 1,000 cycles/month
  2. I donā€™t think that these are nested if statements because they are not indented under other if statements.
  3. Try using this method:
    Rather than if day == "Monday" or day == "M"ā€¦, use this:
    if day.lower() in ['monday', 'm']. This processes the data as lowercase, meaning you only need the lowercase words. It also makes it a list instead of a bunch of ā€œorā€ statements.
1 Like

You forgot the parentheses.