Fungsi operator Identitas

 

Operator identitas berfungsi untuk membandingkan variabel

Misalnya :

Budi = “kelas A”

Ani = “kelas A”

Toni = “kelas B”

 

Print (id (budi))

 

Print (id (ani))

Print(“kelas budi is kelas ani =”, budi is ani)

Print(“kelas ani is kelas toni =”, ani is toni)

Print(“kelas budi is kelas toni =”, toni is budi)

 

Print(“kelas budi is not kelas ani =”, budi is not ani)

Print(“kelas ani is not kelas toni =”, ani is not toni)

Print(“kelas budi is not kelas tonii =”, toni is not budi)

2665453908656

2665453909424

Kelas budi is kelas ani = False

Kelas ani is kelas toni = False

Kelas budi is kelas toni = False

Tebel kebenaran

Tabel Operator AND

True and True = True

True and False = False

False and True = False

False and False = False

 

Tabel Operator OR

True or True = True

True or False = True

False or True = True

False or False = False

Tabel Operator XOR

True or True = False

True or False = True

False or True = True

False or False = False

Tabel Operator NOT

Not False = False

Not True = True

0 Response to "Fungsi operator Identitas"

Posting Komentar

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel