#๐ Homework/Project
24 messages ยท Page 1 of 1 (latest)
@austere lily
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.
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
I don't see that you've made a function yet
That's what I was thinking of doing but I wasn't sure exactly what it meant by boolean
boolean being True or False
ooh
if something is True:
dothis()
else:
dothat()
if x == 1:
True
else
False
smth like that?
The first print statement would be 1 and the 2nd would be 2 or smth?
so make a function that checks something. Depending on this something, if its true, prints an action. if false, prints a different action
ohh got it thank you
His example was
So if I did like if true growls false swipes
just change the last variable basically
sure but make sure that the true or false makes sense
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
np
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