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
# hi python ph :) | |
if __name__ == '__main__': | |
n = int(input()) | |
for i in range(n): | |
print(i * i) |
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
import seaborn as sns | |
fig = plt.subplots(figsize = (10,10)) | |
sns.set(font_scale=1.5) | |
sns.heatmap(df.corr(),square = True,cbar=True,annot=True,annot_kws={'size': 10}) | |
plt.show() |
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
class Person { | |
constructor(firstName, lastName) { | |
this.firstName = firstName; | |
this.lastName = lastName; | |
} | |
fullName() { | |
console.log(`${firstName} ${lastName}`); | |
} | |
} |
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
Person.prototype.sayHi = function() { | |
console.log(`Hi! I'm ${this.firstName}`); | |
} | |
// Note that we did not recreate the objects here | |
personA.sayHi(); // Hi! I'm Adrian | |
personB.sayHi(); // Hi! I'm Be |
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
personA.__proto__ === Person.prototype; |
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
function Person(firstName, lastName) { | |
// 1. An implicit object is created that we can reference with `this` | |
this.firstName = firstName; | |
this.lastName = lastName; | |
} | |
// 2. The resulting instance has a copy of the | |
// constructor function's prototype property | |
// inside its own prototype. | |
Person.prototype.fullName = function() { |
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
function Person(firstName, lastName) { | |
// 1. An implicit object is created that we can reference with `this` | |
this.firstName = firstName; | |
this.lastName = lastName; | |
} | |
// 2. The resulting instance has a copy of the | |
// constructor function's prototype property | |
// inside its own prototype. | |
Person.prototype.fullName = function() { |
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
function Person(firstName, lastName) { | |
return { | |
firstName, | |
lastName, | |
fullName() { | |
console.log(`${this.firstName} ${this.lastName}`) | |
} | |
}; | |
} |
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
class Person: | |
def __init__(self, first_name, last_name): | |
self.first_name = first_name | |
self.last_name = last_name | |
def print_full_name(self): | |
print(f'{self.first_name} {self.last_name}') | |
person_a = Person('Adrian', 'Perea') | |
person_b = Person('Ben', 'Halpern') |
NewerOlder