Skip to content

Instantly share code, notes, and snippets.

View brabemi's full-sized avatar

Miroslav Brabenec brabemi

  • The National Library of Technology
  • Czech Republic
View GitHub Profile
@brabemi
brabemi / formatovani.py
Last active April 11, 2019 08:41
PyLadies - Praha (NTK) - jaro 2019 - Lekce 5 – Řetězce
def vypis_hezky_nasobilku(maximum):
for radek in range(maximum):
for sloupec in range(maximum):
# formátování viz https://naucse.python.cz/2019/pyladies-praha-jaro-ntk/beginners/str/
# Do {} lze zapsat, jak má výstup vypadat viz https://pyformat.info/
# : - pomocný znak, > - zarovnat vpravo, 3 - šířka na 3 znaky
print('{:>3}'.format(radek * sloupec), end=' ')
print()
@brabemi
brabemi / funkce_1.py
Last active October 10, 2019 18:08
PyLadies - Praha (NTK) - podzim 2019 - Lekce 4 – While & Vlastní funkce
def moje_funkce1():
"tato funkce nic nevypíše a nic nevrací"
print('-'*20, 'moje_funkce1()', '-'*20)
print('Funkce vratila:', moje_funkce1())
def moje_funkce2():
"tato funkce vypíše ahoj a nic nevrací"
@brabemi
brabemi / 01_for_a_while.py
Created April 2, 2020 19:42
PyLadies - Praha - jaro 2020 - Lekce 4 – While
from random import randrange
# Házím 6 kostkami, vypíšu nejvyšší hod
# vím kolikrát chci něco udělat -> for cyklus
maximum = 0
for hod in range(6):
hodnota = randrange(1, 7)
print(hodnota)
if maximum < hodnota:
maximum = hodnota
@brabemi
brabemi / uloha.py
Last active April 23, 2020 08:47
PyLadies - Praha (NTK) - podzim 2019 - Lekce 6 – Procvičování & soubory
def vrat_rok(data):
return int(data[-4:])
def spocitej_vek(rok):
return 2019 - rok
def vrat_cele_jmeno(data):
return data[:-5]
@brabemi
brabemi / 12_vozovy_park.py
Created May 28, 2020 18:37
PyLadies - Praha - jaro 2020 - Lekce 12 - Dědičnost
class Vozidlo:
def __init__(self, spz):
self.spz = spz.upper()
self.stav_nadrze = 0
self.najete_km = 0
def dojezd(self):
'''
Vrátí dojezd vozidla v km.
'''
@brabemi
brabemi / 01_printy.py
Created September 24, 2020 20:11
PyLadies - Praha - podzim 2020 - Lekce 2 – Proměnné a podmínky
print("") # prázdný řetězec
print("Ahoj") # toto vytiskne Ahoj
print(1)
print(0.1)
print(1, 2, 3, 4)
print("ahoj", 1, 0.1, "konec")
print(3*4)
print("ahoj" + " to je vše")
print("ahoj" * 80)
print("Ahoj" * 80)
@brabemi
brabemi / 01_funkce.py
Last active October 1, 2020 20:44
PyLadies - Praha - podzim 2020 - Lekce 3 – Funkce a cyklus For
# print("", len(""))
# print("1", len("1"))
# print("12", len("12"))
# print("1234", len("1234"))
retezec = "ahoj"
delka = len(retezec)
print(delka, delka**2)
print("delka řetězce", retezec, "je", len(retezec))
@brabemi
brabemi / 00_readme.md
Last active November 28, 2021 22:41
PyLadies - Praha - podzim 2021 - Lekce 4 – While & Opakování cyklů
@brabemi
brabemi / 00_readme.md
Last active December 3, 2022 09:41
PyLadies - Praha - podzim 2022 - Lekce 11
@brabemi
brabemi / 00_readme.md
Last active December 12, 2022 17:02
Lekce: Třídy II & Dědičnost (2022-12-07)