-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from petrknap/chores
chore: added PR template
- Loading branch information
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
- [ ] This pull request does not contain any breaking change | ||
- [ ] I asked [the AI](https://copilot.microsoft.com/) to briefly summarize, use and improve the feature(s), and I'm okay with the output: | ||
<!-- ⇅ remove it if it doesn't make sense ⇅ --> | ||
<!-- ↓ here belongs the AI inputs (>>) and outputs (>) ↓ --> | ||
>> Could you briefly summarize the following code for me? | ||
>> ```python | ||
>> class Tiger: | ||
>> def __init__(self, name): | ||
>> self.name = name | ||
>> | ||
>> def roar(self): | ||
>> print(f"{self.name} lets out a powerful roar!") | ||
>> ``` | ||
> | ||
> This code defines a Python class named `Tiger` with a constructor that initializes the tiger's name, and a `roar` method that prints a message including the tiger's name. Simple and elegant, just like a tiger! 🐅 | ||
> | ||
>> Could you show me how to use it? | ||
> | ||
> Sure, here's how to create and use a `Tiger` object with the class you have: | ||
> ```python | ||
> # Create an instance of Tiger | ||
> my_tiger = Tiger("Gopal") | ||
> | ||
> # Call the roar method | ||
> my_tiger.roar() | ||
> ``` | ||
> | ||
> When you run this code, it will output: | ||
> ``` | ||
> Gopal lets out a powerful roar! | ||
> ``` | ||
> | ||
> That's how you bring your Tiger to life! 🎉 | ||
> | ||
>> Is there any way to do it better? | ||
> | ||
> Absolutely. You could add error handling, additional methods, or even inheritance. Here's an enhanced version: | ||
> ```python | ||
> class Tiger: | ||
> def __init__(self, name): | ||
> self.name = name | ||
> | ||
> def roar(self): | ||
> print(f"{self.name} lets out a powerful roar!") | ||
> | ||
> def introduce(self): | ||
> print(f"Meet {self.name}, the majestic tiger!") | ||
> | ||
> # Usage | ||
> my_tiger = Tiger("Gopal") | ||
> my_tiger.introduce() # Output: Meet Gopal, the majestic tiger! | ||
> my_tiger.roar() # Output: Gopal lets out a powerful roar! | ||
> ``` | ||
> | ||
> Now your tiger can introduce itself, too. 🐯📢 | ||
<!-- ↑ this is an example, replace it ↑ --> |