Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.
| Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung Nächste Überarbeitung | Vorherige Überarbeitung | ||
| user:hof:pyeditor [2026-04-24 14:24] – [Basic Usage] hof | user:hof:pyeditor [2026-04-24 14:29] (aktuell) – hof | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| # Bottom Python Editor | # Bottom Python Editor | ||
| - | < | ||
| Bottom Editor offers a standalone editor version at [[https:// | Bottom Editor offers a standalone editor version at [[https:// | ||
| Zeile 31: | Zeile 30: | ||
| </ | </ | ||
| </ | </ | ||
| - | > | + | |
| ## Shared Sessions | ## Shared Sessions | ||
| By default, all editors on a page share a single python runtime. Functions defined in one execution are available in all editors afterwards, similar to jupyter notebooks. If you want an editor to have a separate python runtime, use the `session` attribute: | By default, all editors on a page share a single python runtime. Functions defined in one execution are available in all editors afterwards, similar to jupyter notebooks. If you want an editor to have a separate python runtime, use the `session` attribute: | ||
| Zeile 67: | Zeile 67: | ||
| <code html> | <code html> | ||
| - | < | + | < |
| import turtle | import turtle | ||
| Zeile 77: | Zeile 77: | ||
| t.forward(i * 0.5) | t.forward(i * 0.5) | ||
| t.left(59) | t.left(59) | ||
| - | </ | + | </ |
| </ | </ | ||
| - | < | + | < |
| import turtle | import turtle | ||
| Zeile 90: | Zeile 90: | ||
| t.forward(i * 0.5) | t.forward(i * 0.5) | ||
| t.left(59) | t.left(59) | ||
| - | </ | + | </ |
| ## Matplotlib | ## Matplotlib | ||
| Zeile 96: | Zeile 96: | ||
| <code html> | <code html> | ||
| - | < | + | < |
| # Load packages from within python using micropip | # Load packages from within python using micropip | ||
| import micropip | import micropip | ||
| Zeile 112: | Zeile 112: | ||
| plt.tight_layout() | plt.tight_layout() | ||
| plt.show() | plt.show() | ||
| - | </ | + | </ |
| </ | </ | ||
| - | < | + | < |
| # Load packages from within python using micropip | # Load packages from within python using micropip | ||
| import micropip | import micropip | ||
| Zeile 131: | Zeile 131: | ||
| plt.tight_layout() | plt.tight_layout() | ||
| plt.show() | plt.show() | ||
| - | </ | + | </ |
| ## OpenCV | ## OpenCV | ||
| Zeile 137: | Zeile 137: | ||
| <code html> | <code html> | ||
| - | < | + | < |
| # Load packages from within python using micropip | # Load packages from within python using micropip | ||
| import micropip | import micropip | ||
| Zeile 154: | Zeile 154: | ||
| cv2.putText(img, | cv2.putText(img, | ||
| cv2.imshow(' | cv2.imshow(' | ||
| - | </ | + | </ |
| </ | </ | ||
| - | < | + | < |
| # Load packages from within python using micropip | # Load packages from within python using micropip | ||
| import micropip | import micropip | ||
| Zeile 174: | Zeile 174: | ||
| cv2.putText(img, | cv2.putText(img, | ||
| cv2.imshow(' | cv2.imshow(' | ||
| - | </ | + | </ |
| ## Installing files | ## Installing files | ||
| Zeile 180: | Zeile 180: | ||
| <code html> | <code html> | ||
| - | < | + | < |
| with open(' | with open(' | ||
| for line in infile: | for line in infile: | ||
| Zeile 187: | Zeile 187: | ||
| if town == ' | if town == ' | ||
| print(f' | print(f' | ||
| - | </ | + | </ |
| </ | </ | ||
| - | < | + | < |
| with open(' | with open(' | ||
| for line in infile: | for line in infile: | ||
| Zeile 197: | Zeile 197: | ||
| if town == ' | if town == ' | ||
| print(f' | print(f' | ||
| - | </ | + | </ |
| ## Exercises | ## Exercises | ||
| <code html> | <code html> | ||
| - | < | + | < |
| - | < | + | |
| Write a function < | Write a function < | ||
| <tt>1 + 2 + & | <tt>1 + 2 + & | ||
| Zeile 219: | Zeile 219: | ||
| return sum(range(n+1)) | return sum(range(n+1)) | ||
| </ | </ | ||
| - | </ | + | </ |
| </ | </ | ||
| - | < | + | < |
| Write a function < | Write a function < | ||
| <tt>1 + 2 + & | <tt>1 + 2 + & | ||
| Zeile 239: | Zeile 239: | ||
| return sum(range(n+1)) | return sum(range(n+1)) | ||
| </ | </ | ||
| - | </ | + | </ |
| ## Persistence | ## Persistence | ||
| Zeile 245: | Zeile 246: | ||
| <code html> | <code html> | ||
| - | < | + | < |
| print(42) | print(42) | ||
| - | </ | + | </ |
| </ | </ | ||
| - | < | + | < |
| print(42) | print(42) | ||
| - | </ | + | </ |