This file contains hidden or 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
__repr__ | __str__ | |
---|---|---|
Provides an unambiguous string representation of an object. | Provides a human-readable string representation of an object. | |
Mainly intended for developers and debugging purposes. | Intended for end-users and display purposes. | |
If not explicitly defined, Python will use the default implementation. | If not explicitly defined, Python will call the __repr__ method as a fallback. |
This file contains hidden or 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
Traditional Startup | Micro Startup | |
---|---|---|
Large team | Small team | |
Broad focus | Narrow focus | |
Higher overhead costs | Lower overhead costs | |
Greater scalability potential | Limited scalability | |
More expertise and experience | Limited expertise | |
Greater market potential | Limited market potential | |
Higher risk | Lower risk | |
May take longer to get off the ground | May be able to get off the ground more quickly |
This file contains hidden or 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
print(f"Total number of elements in list: {len(object_list)}") | |
# for obj in object_list: | |
# print(obj) | |
# Create a set from the list of objects | |
object_set = set(object_list) | |
# OR |
This file contains hidden or 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
books = [ | |
{ | |
"author": "Chinua Achebe", | |
"title": "Things Fall Apart", | |
"year": 1958 | |
}, | |
{ | |
"author": "Hans Christian Andersen", | |
"title": "Fairy tales", | |
"year": 1836 |
This file contains hidden or 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
class Book: | |
title = None | |
author = None | |
year = None | |
def __init__(self, author, title, year): | |
self.author = author | |
self.title = title | |
self.year = year | |
This file contains hidden or 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
class Node: | |
def __init__(self, data): | |
self.data = data | |
self.left, self.right = None, None | |
def __str__(self): | |
return str(self.data) | |
def insert(self, data): | |
if self.data: |