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-24 14:24] hofuser:hof:pyeditor [2026-04-24 14:29] (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> 
  
 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 68: Zeile 67:
  
 <code html> <code html>
-<html><bottom-editor layout="canvas" autorun>+<bottom-editor layout="canvas" autorun id="turtle">
 import turtle import turtle
  
Zeile 78: Zeile 77:
     t.forward(i * 0.5)     t.forward(i * 0.5)
     t.left(59)     t.left(59)
-</bottom-editor></html>+</bottom-editor>
 </code> </code>
  
-<html><bottom-editor layout="canvas" autorun>+<bottom-editor layout="canvas" autorun id="turtle">
 import turtle import turtle
  
Zeile 91: Zeile 90:
     t.forward(i * 0.5)     t.forward(i * 0.5)
     t.left(59)     t.left(59)
-</bottom-editor></html>+</bottom-editor>
  
 ## Matplotlib ## Matplotlib
Zeile 97: Zeile 96:
  
 <code html> <code html>
-<html><bottom-editor layout="canvas" autorun>+<bottom-editor layout="canvas" autorun id="matplotlib">
 # Load packages from within python using micropip # Load packages from within python using micropip
 import micropip import micropip
Zeile 113: Zeile 112:
 plt.tight_layout() plt.tight_layout()
 plt.show() plt.show()
-</bottom-editor></html>+</bottom-editor>
 </code> </code>
  
-<html><bottom-editor layout="canvas" autorun>+<bottom-editor layout="canvas" autorun id="matplot">
 # Load packages from within python using micropip # Load packages from within python using micropip
 import micropip import micropip
Zeile 132: Zeile 131:
 plt.tight_layout() plt.tight_layout()
 plt.show() plt.show()
-</bottom-editor></html>+</bottom-editor>
  
 ## OpenCV ## OpenCV
Zeile 138: Zeile 137:
  
 <code html> <code html>
-<html><bottom-editor layout="canvas" autorun>+<bottom-editor layout="canvas" autorun id="opencv">
 # Load packages from within python using micropip # Load packages from within python using micropip
 import micropip import micropip
Zeile 155: Zeile 154:
 cv2.putText(img, 'OpenCV', (75, 160), cv2.FONT_HERSHEY_SIMPLEX, 1, (255,255,255), 2) cv2.putText(img, 'OpenCV', (75, 160), cv2.FONT_HERSHEY_SIMPLEX, 1, (255,255,255), 2)
 cv2.imshow('result', img) cv2.imshow('result', img)
-</bottom-editor></html>+</bottom-editor>
 </code> </code>
  
-<html><bottom-editor layout="canvas" autorun>+<bottom-editor layout="canvas" autorun id="opencv">
 # Load packages from within python using micropip # Load packages from within python using micropip
 import micropip import micropip
Zeile 175: Zeile 174:
 cv2.putText(img, 'OpenCV', (75, 160), cv2.FONT_HERSHEY_SIMPLEX, 1, (255,255,255), 2) cv2.putText(img, 'OpenCV', (75, 160), cv2.FONT_HERSHEY_SIMPLEX, 1, (255,255,255), 2)
 cv2.imshow('result', img) cv2.imshow('result', img)
-</bottom-editor></html>+</bottom-editor>
  
 ## Installing files ## Installing files
Zeile 181: Zeile 180:
  
 <code html> <code html>
-<html><bottom-editor zip='https://bottom.ch/ksr/py/files/2m.zip'>+<bottom-editor zip='https://bottom.ch/ksr/py/files/2m.zip' id="zip">
 with open('gemeinden.csv', 'r') as infile: with open('gemeinden.csv', 'r') as infile:
     for line in infile:     for line in infile:
Zeile 188: Zeile 187:
         if town == 'Romanshorn':         if town == 'Romanshorn':
             print(f'Romanshorn hat {tokens[2]} Einwohner')             print(f'Romanshorn hat {tokens[2]} Einwohner')
-</bottom-editor></html>+</bottom-editor>
 </code> </code>
  
-<html><bottom-editor zip='https://bottom.ch/ksr/py/files/2m.zip'>+<bottom-editor zip='https://bottom.ch/ksr/py/files/2m.zip' id="zip">
 with open('gemeinden.csv', 'r') as infile: with open('gemeinden.csv', 'r') as infile:
     for line in infile:     for line in infile:
Zeile 198: Zeile 197:
         if town == 'Romanshorn':         if town == 'Romanshorn':
             print(f'Romanshorn hat {tokens[2]} Einwohner')             print(f'Romanshorn hat {tokens[2]} Einwohner')
-</bottom-editor></html>+</bottom-editor> 
 ## Exercises ## Exercises
  
 <code html> <code html>
-<html><script type="module" src="https://bottom.ch/editor/stable/bottom-exercise.js"></script></html> +<bottom-exercise id="sum-to_n">
-<html><bottom-exercise id="sum-to_n">+
             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
Zeile 220: Zeile 219:
     return sum(range(n+1))     return sum(range(n+1))
         </script>                 </script>        
-</bottom-exercise></html>+</bottom-exercise>
 </code> </code>
  
-<html><bottom-exercise id="sum-to_n">+<bottom-exercise id="sum-to_n">
             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
Zeile 240: Zeile 239:
     return sum(range(n+1))     return sum(range(n+1))
         </script>                 </script>        
-</bottom-exercise></html>+</bottom-exercise> 
 ## Persistence ## Persistence
  
Zeile 246: Zeile 246:
  
 <code html> <code html>
-<html><bottom-editor style="min-height: 6lh;" id="storage-42">+<bottom-editor style="min-height: 6lh;" id="storage-42">
 print(42) print(42)
-</bottom-editor></html>+</bottom-editor>
 </code> </code>
  
  
-<html><bottom-editor style="min-height: 6lh;" id="storage-42">+<bottom-editor style="min-height: 6lh;" id="storage-42">
 print(42) print(42)
-</bottom-editor></html>+</bottom-editor>
  
  • user/hof/pyeditor.1777040699.txt.gz
  • Zuletzt geändert: 2026-04-24 14:24
  • von hof