From 213c75b367c1ce532be765f0437923629fc4b33a Mon Sep 17 00:00:00 2001
From: Martin Mares <mj@ucw.cz>
Date: Tue, 8 Oct 2024 10:15:15 +0200
Subject: [PATCH] =?UTF-8?q?Cykly:=20Prvn=C3=AD=20p=C5=99=C3=ADklad=20zkus?=
=?UTF-8?q?=C3=ADme=20napsat=20bez=20breaku?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
02-cykly/02-cykly.tex | 2 +-
02-cykly/prvocisla-test.py | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/02-cykly/02-cykly.tex b/02-cykly/02-cykly.tex
index a05cc09..4ac5298 100644
--- a/02-cykly/02-cykly.tex
+++ b/02-cykly/02-cykly.tex
@@ -109,7 +109,7 @@ Existuje zkratka:
% ----------------------------------------------------------------------
-\begin{frame}{Příklad: jak funguje else za cyklem}
+\begin{frame}{Příklad: break a else za cyklem}
\verbatiminput{prvocisla-else.py}
diff --git a/02-cykly/prvocisla-test.py b/02-cykly/prvocisla-test.py
index a224809..41acbe2 100755
--- a/02-cykly/prvocisla-test.py
+++ b/02-cykly/prvocisla-test.py
@@ -5,11 +5,10 @@ n = int(input())
d = 2
mam_delitele = False
-while d < n:
+while d < n and not mam_delitele:
if n%d == 0:
print("Číslo", n, "je dělitelné", d)
mam_delitele = True
- break
d += 1
if not mam_delitele:
--
GitLab