Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.

Link zu der Vergleichsansicht

Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung
Nächste Überarbeitung
Vorherige Überarbeitung
user:hof:pyeditor [2026-04-13 11:30] – [Exercises] hofuser:hof:pyeditor [2026-04-16 19:59] (aktuell) hof
Zeile 1: Zeile 1:
 # Bottom Python Editor # Bottom Python Editor
-<html><script type="module" src="https://bottom.ch/editor/latest/bottom-exercise.js"></script></html>+<html><script type="module" src="https://bottom.ch/editor/stable/bottom-exercise.js"></script></html>
  
 Bottom Editor offers a standalone editor version at [[https://bottom.ch/editor/]] and a web component embeddable as normal HTML elements after loading the module once. See the [[https://bottom.ch/editor/stable/doc/|public documentation]] for all options. Bottom Editor offers a standalone editor version at [[https://bottom.ch/editor/]] and a web component embeddable as normal HTML elements after loading the module once. See the [[https://bottom.ch/editor/stable/doc/|public documentation]] for all options.
Zeile 192: Zeile 192:
 <code html> <code html>
 <html><script type="module" src="https://bottom.ch/editor/latest/bottom-exercise.js"></script></html> <html><script type="module" src="https://bottom.ch/editor/latest/bottom-exercise.js"></script></html>
-<html><bottom-exercise> +<html><bottom-exercise id="sum-to_n"
-            <p>Write a function <tt>sum_to(n)</tt> that returns+            Write a function <tt>sum_to(n)</tt> that returns
             <tt>1 + 2 + &hellip; + n</tt>. Return <tt>0</tt> for             <tt>1 + 2 + &hellip; + n</tt>. Return <tt>0</tt> for
-            <tt>n &le; 0</tt>.</p>+            <tt>n &le; 0</tt>.
         <script type="text/x-starter">         <script type="text/x-starter">
 def sum_to(n): def sum_to(n):
Zeile 208: Zeile 208:
 </code> </code>
  
-<html><bottom-exercise> +<html><bottom-exercise id="sum-to_n"
-        Write a function <tt>fizzbuzz(n)</tt> that returns +            Write a function <tt>sum_to(n)</tt> that returns 
-        <tt>"Fizz"</tt> if <tt>n</v> is divisible by 3, +            <tt>1 + 2 + &hellip; + n</tt>. Return <tt>0</tt> for 
-        <tt>"Buzz"</tt> if divisible by 5, +            <tt>n &le; 0</tt>.
-        <tt>"FizzBuzz"</tt> if divisible by both, or the number +
-        as a string otherwise.+
         <script type="text/x-starter">         <script type="text/x-starter">
-def fizzbuzz(n):+def sum_to(n):
     pass     pass
         </script>         </script>
         <script type="text/x-test">         <script type="text/x-test">
-assert fizzbuzz(3) == "Fizz", f"fizzbuzz(3) should be 'Fizz', got {fizzbuzz(3)!r}" +assert sum_to(5) == 15, "sum_to(5) should be 15" 
-assert fizzbuzz(5) == "Buzz"f"fizzbuzz(5) should be 'Buzz', got {fizzbuzz(5)!r}" +assert sum_to(1) == 1, "sum_to(1) should be 1
-assert fizzbuzz(15) == "FizzBuzz", f"fizzbuzz(15) should be 'FizzBuzz', got {fizzbuzz(15)!r}+assert sum_to(0) == 0, "sum_to(0) should be 0"
-assert fizzbuzz(7) == "7"f"fizzbuzz(7) should be '7', got {fizzbuzz(7)!r}+
-assert fizzbuzz(1) == "1"f"fizzbuzz(1) should be '1', got {fizzbuzz(1)!r}"+
         </script>         </script>
-    </bottom-exercise></html>+</bottom-exercise></html>
  
  • user/hof/pyeditor.1776079807.txt.gz
  • Zuletzt geändert: 2026-04-13 11:30
  • von hof