https://naucse.python.cz/2023/praha-pyladies-podzim/sessions/while-functions/
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
# Osnova lekce - https://github.com/PetraVidnerova/PyLadies_pokr/tree/main/lesson_time | |
from pprint import pprint | |
from random import randrange | |
from time import time | |
# import string | |
retezec = 'skakal pes pres oves' | |
def vygeneruj_retezec(delka): |
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
# 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)) |
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
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) |
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 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. | |
''' |
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 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 |
NewerOlder