lehrkraefte:blc:informatik:ffprg1-2020:print

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
lehrkraefte:blc:informatik:ffprg1-2020:print [2020/02/03 16:52]
Ivo Blöchliger [Aufgaben]
lehrkraefte:blc:informatik:ffprg1-2020:print [2022/02/08 07:36] (current)
Ivo Blöchliger [Ausgabe von Text]
Line 12: Line 12:
 ===== Ausgabe von Text ===== ===== Ausgabe von Text =====
 Beachten Sie, dass Text immer von Anführungs- und Schlusszeichen umgeben ist (double-quotes). In Python ist auch möglich, gerade Apostroph (single quotes) zu verwenden: Beachten Sie, dass Text immer von Anführungs- und Schlusszeichen umgeben ist (double-quotes). In Python ist auch möglich, gerade Apostroph (single quotes) zu verwenden:
-<code> +<code python
-print('Hello World!')+print('I said "Hello world!"')
 </code> </code>
 +Das ist besonders dann praktisch, wenn in der Zeichenkette selbst double-quotes vorkommen. Sonst müssten die Zeichen mit einem Backslash geschützt werden:
 +<code python>
 +print("I said \"Hello world!\"")
 +</code>
 +
 +
  
 ===== Arithmetische Ausdrücke ===== ===== Arithmetische Ausdrücke =====
Line 23: Line 29:
 print("2+3*4 ergibt nicht 20 sondern:") print("2+3*4 ergibt nicht 20 sondern:")
 print(2+3*4) print(2+3*4)
-print("Die Wurzel aus 2 ist:")+print("Die Wurzel aus 2 ist (potenzieren mit 0.5 ergibt die Wurzel, warum?):")
 print(2**0.5) print(2**0.5)
 </code> </code>
Line 46: Line 52:
 ====== Quizz ====== ====== Quizz ======
  
-<quizlib id="quiz" rightanswers="['42']" submit="Check Answers">+<quizlib id="quiz" rightanswers="['42', '1024']" submit="Check Answers">
     <question title="Was ist die Ausgabe von &lt;pre&gt;print((5+1)*(8-1))&lt;/pre&gt;" type="text"></question>     <question title="Was ist die Ausgabe von &lt;pre&gt;print((5+1)*(8-1))&lt;/pre&gt;" type="text"></question>
 +    <question title="Was ist die Ausgabe von &lt;pre&gt;print(2**10)&lt;/pre&gt;" type="text"></question>
 </quizlib> </quizlib>
  • lehrkraefte/blc/informatik/ffprg1-2020/print.1580745130.txt.gz
  • Last modified: 2020/02/03 16:52
  • by Ivo Blöchliger