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
gf_informatik:zahlensysteme [2023-06-02 07:36] – [Lösungen] scagf_informatik:zahlensysteme [2023-06-06 21:30] (aktuell) – [Lösungen] sca
Zeile 99: Zeile 99:
  
 ===== Lösungen ===== ===== Lösungen =====
- 
-<nodisp 1> 
  
 ++++Binary to Decimal| ++++Binary to Decimal|
Zeile 224: Zeile 222:
     b2 = b2.replace(" ","") # remove all blanks         b2 = b2.replace(" ","") # remove all blanks    
     result = ""     result = ""
 +    
     i = len(b1) - 1     i = len(b1) - 1
     while i >= 0:     while i >= 0:
Zeile 233: Zeile 232:
     while len(result) > 1 and result[0] == '0': # remove all zeros at beginning     while len(result) > 1 and result[0] == '0': # remove all zeros at beginning
         result = result[1:]         result = result[1:]
 +
     return result     return result
 </code> </code>
Zeile 238: Zeile 238:
 ++++ ++++
  
-</nodisp> 
  
  
Zeile 378: Zeile 377:
 <code python> <code python>
 ### EXERCISE GENERATOR ### EXERCISE GENERATOR
- 
 for i in range(3): for i in range(3):
     da = random.randint(128,256)     da = random.randint(128,256)
Zeile 392: Zeile 390:
     a = bin(da)[2:]     a = bin(da)[2:]
     print("Berechne schriftlich von Hand (Bemerkung & isPencil-Feld), trage Resultat ins Antwortfeld ein. 2-er Komplement in 8-Bit von:\n" + a)     print("Berechne schriftlich von Hand (Bemerkung & isPencil-Feld), trage Resultat ins Antwortfeld ein. 2-er Komplement in 8-Bit von:\n" + a)
-    print("LOESUNG: " + invert(a) + "\n") +    print("LOESUNG: " + binary_complement(a) + "\n")
  
 for i in range(3): for i in range(3):
Zeile 414: Zeile 411:
     print("Berechne schriftlich von Hand (Bemerkung & isPencil-Feld), trage Resultat ins Antwortfeld ein.\n" + a + " * " + b )     print("Berechne schriftlich von Hand (Bemerkung & isPencil-Feld), trage Resultat ins Antwortfeld ein.\n" + a + " * " + b )
     print("LOESUNG: " + bin(da*db)[2:] + "\n")     print("LOESUNG: " + bin(da*db)[2:] + "\n")
- 
 </code> </code>
 ++++ ++++
  • gf_informatik/zahlensysteme.1685691377.txt.gz
  • Zuletzt geändert: 2023-06-02 07:36
  • von sca