Is at Python 2.7 and 3.0 something wrong with implementation of bool ? (would concern C too ! )

Here is a snippet written in Python - but error is same as well in 2.7 as in 3.0.
It could affect core-development too - where is the bug (of me or of the hardware ?) :

:slight_smile:

Important to say - no offense ! Here is snippet :

#!/usr/bin/python

import sys
import math
import os

# import bool +++ is not yet there, but in c it is given with <stdbool.h>
# have removed the elder comments - cause WYSIWYG is not working ?
# this snippet is simply intended for to check if circuits are working properly
# it looks weird and trivial, but would help to check if boole in processor is correct ?

def circuit(i):
a = int(sys.argv[1])
b = int(sys.argv[1])
 
        switcher={
                10:'AND', print('Type two binary values ( 0 or 1 each) for AND :')
                print('a={:d}, b={:d}, c2={:d}'.format(f(c2 = (a and b)))
                
                20:'OR', printf('Type two binary values ( 0 or 1 each) for OR :')
                print('a={:d}, b={:d}, c2={:d}'.format(f(c2 = (a or b)))

                30:'NAND', printf('Type two binary values ( 0 or 1 each) for NOT AND :')
                print('a={:d}, b={:d}, c2={:d}'.format(f(c2 = (not a and not b)))
                
                40:'NOR', printf('Type two binary values ( 0 or 1 each) for NOT OR :')
                print('a={:d}, b={:d}, c2={:d}'.format(f(c2 = (not a or not b)))
                
                50:'XOR', printf('Type two binary values ( 0 or 1 each) for XOR :')
                print('a={:d}, b={:d}, c2={:d}'.format(f(c2 = (a xor b)))
                
                60:'BELL', printf('\a')
                
                70:'CLOCK with DATE', from datetime import date
                today = date.today()
                print('Today's date:', today)

         return switcher.get(i,"Invalid operation")
         }
         
         c = print('c2={:d}')
         
         print('Diversity is the freedom for to be different ! (Wisdom of ancient ages)'


Python keywords include ‘and’, ‘or’, ‘not’. Note that they are all in lowercase.

Writing your code in a code block would make it much more readable for who tries to help you. Anyhow: the line c = int c2 is not valid Python syntax and you cannot interleave statements and expressions in the dictionary definition as you do, ie you cannot have the print(...) lines in your code where you placed them. I don’t see how this has anything to do with the implementation of bool nor why you somehow expect import bool to do something meaningful.

Hello Daniele, ty for hint with “code blocks” - I did not know this term
for to edit further. For the rest of your hints I look after next minutes …

bool or boole is here for to check circuits.
It would say then, if bool is implemented correctly by hardware or
by programming language ? It would depend on error output.