From 46caa0dbad38812873d7b851e995aced1be79439 Mon Sep 17 00:00:00 2001 From: Hizenberg469 Date: Thu, 6 Mar 2025 16:54:11 +0000 Subject: [PATCH] Short circuiting done --- Basic/prog.py | 1 + Basic/wiki.txt | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 Basic/prog.py diff --git a/Basic/prog.py b/Basic/prog.py new file mode 100644 index 0000000..ad26664 --- /dev/null +++ b/Basic/prog.py @@ -0,0 +1 @@ +print(bool(None)) \ No newline at end of file diff --git a/Basic/wiki.txt b/Basic/wiki.txt index 961fcfe..4f0b29e 100644 --- a/Basic/wiki.txt +++ b/Basic/wiki.txt @@ -81,6 +81,8 @@ provide the new overrided value instead of previous value. Hence, key of Dictionary should be unique + tuple can be used as key for Dictionary but not list. + -> list and tuple: list are mutable but tuple are immutable @@ -91,3 +93,48 @@ might result in error, but to avoid that we can use methods instead of keyword for accessing any value and avoiding error. + +-> difference_update method in sets: + + It is used to delete members which is present in set + which is passed as parameter to this method and the + object which used this method having same elements + as present in the set passed as parameter is removed + and the object set is modified. + + +-> union and intersection operator of set: + + union : | + intersection : & + +-> Truthy and falsey: + + some value if their type is converted using + type() function. + + Truthy: Conversion to True value from some value is a + Truthy value. + + Falsey: Conversion to False value from some value is a + Falsey value. + + For ex: + + bool("hello") -> True (Truthy) + bool('') -> False (Falsey) + bool(0) -> False (Falsey) + bool(199) -> True (Truthy) + +-> Ternary Operator or conditional expression: + + if else + +-> Short Circuiting: + + true and true : Both are evaluated + false and true : first is evaluated + false and false : first is evaluated + true or true : first is evaluated + false or true : both are evaluated + false or false : both are evaluated \ No newline at end of file