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
// Place your key bindings in this file to override the defaults | |
[ | |
{ | |
"key": "cmd+r", | |
"command": "workbench.action.gotoSymbol" | |
}, | |
{ | |
"key": "cmd+;", | |
"command": "cursorLineEnd" | |
} |
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
# Advent of code 2019 6 solution | |
# using anytree ([https://anytree.readthedocs.io/en/latest/](https://anytree.readthedocs.io/en/latest/)) | |
from collections import defaultdict | |
from anytree import Node, Walker | |
orbit_map = defaultdict(list) | |
orbit_set = set() | |
orbit_tree = {} |
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 Vehicle: | |
def __init__(self, number_of_wheels, fuel_type, maximum_velocity): | |
self.number_of_wheels = number_of_wheels | |
self.type_of_tank = fuel_type | |
self.maximum_velocity = maximum_velocity | |
def make_noise(self): | |
print('VRUUUUUUUM') |
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
prices = { 'milk': 3.67, 'bread': 1.67, 'cheese': 4.67 } | |
print(prices) | |
print(prices['milk']) | |
# προσθήκη ζεύγους κλειδιού τιμής | |
prices['butter'] = 1.95 | |
# διαγραφή στοιχείου | |
del prices['butter'] |
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
colors = ['red','green','blue', 'yellow'] | |
a_list = [] # κενή λίστα | |
whatever = ['abc', 4.56, [2,3], 'def', 6] | |
print(whatever) | |
print(colors[0]) # 'red' | |
print(colors[1]) # 'green' | |
print(colors[-1]) # 'yellow' |
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
word = 'Python' | |
# ο πρώτος χαρακτήρας | |
print(word[0]) | |
# ο δεύτερος χαρακτήρας | |
print(word[1]) | |
print(word[2]) | |
print(word[3]) |
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
def add(a, b): | |
c = a + b | |
return c | |
print(add(2, 3)) | |
def find_min(a,b): | |
if a < b: | |
return a |
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
num = int(input("X: ")) | |
# έξοδος με μηδέν | |
while num != 0: | |
print(1/num) | |
num = int(input("X: ")) | |
# έξοδος με break | |
while True: | |
num = int(input("X: ")) |
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
max = 10 | |
x = 50 | |
if x > max: | |
print('μεγαλύτερο') | |
else: | |
print('μικρότερο') | |
if x > max: | |
max = x |
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
2 + 2 | |
# 4 | |
50 - 5*6 | |
# 20 | |
(50 - 5*6) / 4 | |
# 5.0 | |
8 / 5 |
NewerOlder