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 Phone: | |
def __init__(self): | |
print("Phone constructor invoked.") | |
def call_number(self, phone_number): | |
print("Calling number {}".format(phone_number)) | |
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 Snake(Animal): | |
__temperature = 28 | |
def __init__(self, name, temperature): | |
super().__init__(name, 2, True, 0) | |
self.temperature = temperature | |
# | |
# METHODS | |
# |
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 Animal: | |
__name = None | |
__age = 0 | |
__is_hungry = False | |
__nr_of_legs = 0 | |
def __init__(self, name, age, is_hungry, nr_of_legs): | |
self.name = name | |
self.age = age | |
self.is_hungry = is_hungry |
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
>>> from Gadget import Gadget | |
>>> my_iphone = Gadget(240,'iOS',1980,4) | |
>>> my_iphone.weight | |
240 | |
>>> my_iphone.weight = 255 | |
>>> my_iphone.weight | |
255 | |
>>> | |
>>> | |
>>> my_iphone.operating_system |
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 Gadget: | |
"""A class used for modelling Gadgets in a web shop.""" | |
__weight = 100 | |
__operating_system = None | |
__battery_capacity = 2000 | |
__screen_size = 1 | |
def __init__(self, weight, operating_system, battery_capacity, screen_size): | |
self.__weight = weight | |
self.__operating_system = operating_system |
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
my_iphone = Gadget(weight = 128, operating_system="iOS", battery_capacity=2800, screen_size=4) | |
print(my_iphone.weight) | |
print(my_iphone.operating_system) | |
print(my_iphone.battery_capacity) | |
print(my_iphone.screen_size) |
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 Gadget: | |
weight = 100 | |
operating_system = None | |
battery_capacity = 2000 | |
screen_size = 1 | |
def __init__(self, weight, operating_system, battery_capacity, screen_size): | |
self.weight = weight | |
self.operating_system = operating_system | |
self.battery_capacity = battery_capacity |
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 Gadget: | |
weight = 100 | |
operating_system = None | |
battery_capacity = 2000 | |
screen_size = 1 | |
my_iphone = Gadget() |
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
<!DOCTYPE html> | |
<html> | |
<!-- HTML dokumentum fej része --> | |
<head> | |
<!-- Erre azért van szükség, hogy a böngésző meg tudja jeleníteni az ékezetes magyar betüket --> | |
<meta charset="utf-8"> | |
<!-- Hivatkozunk a hello_vilag2.js kódfájlra --> | |
<script src="hello_vilag2.js" type="text/javascript"></script> | |
</head> |
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
console.log("Hello Világ"); |