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
| #check for two numbers in a sequence to add up to a given number | |
| def sum_of_two_numbers(self, num, limit): | |
| list() | |
| #condition to for the addition | |
| for i in range (0, len(list)): | |
| if target - num in list: | |
| return (list[limit - num] + 1, i + 1) | |
| list[num] = i |
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 Author: | |
| def __init__(self, firstname, lastname): | |
| self.firstname = firstname | |
| self.lastname = lastname | |
| def __str__(self): | |
| return str(self.firstname) + ' ' + (self.lastname) | |
| class Book: | |