#๐Ÿ”’ Homework/Project

24 messages ยท Page 1 of 1 (latest)

latent fulcrumBOT
#

@austere lily

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

austere lily
#

The project asks for 1. Create a class
a. Four attributes, at least
2. Function
a. Prints an action depending on a Boolean value
3. Calls the function in the main body to execute

#
class Animal:
    def __init__(self, species, action, color, sound):
        self.species = species
        self.action = action
        self.color = color
        self.sound = sound

my_Animal = Animal(species="Dog", action= "Jumps", color= "Brown", sound= "Barks")
print(f"The {my_Animal.color} {my_Animal.species} {my_Animal.action} and {my_Animal.sound}")
#

This is what I did so far but I don't get what it means by boolean value

lone fog
#

I don't see that you've made a function yet

austere lily
#

That's what I was thinking of doing but I wasn't sure exactly what it meant by boolean

lone fog
#

boolean being True or False

austere lily
#

ooh

lone fog
#
if something is True:
  dothis()
else:
  dothat()
austere lily
#
if x == 1:
  True
else
  False 
#

smth like that?

#

The first print statement would be 1 and the 2nd would be 2 or smth?

lone fog
#

so make a function that checks something. Depending on this something, if its true, prints an action. if false, prints a different action

austere lily
#

ohh got it thank you

#

His example was

#

So if I did like if true growls false swipes

#

just change the last variable basically

lone fog
#

sure but make sure that the true or false makes sense

austere lily
#

Got it, makes sense thank you so much

#

I wasn't for sure if that's what he meant with the boolean but the clarification makes it so much easier

lone fog
#

np

latent fulcrumBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.

#

๐Ÿ”’ Homework/Project