Python Operators Complete Notes
Complete Explanation (સંપૂર્ણ સમજૂતી)
1. Arithmetic (ગણિતીય)
👉 Used for mathematical operations (ગણિતના દાખલા ગણવા માટે).
- + - * / : Addition, Subtraction, Multiplication, Division (સરવાળો, બાદબાકી, ગુણાકાર, ભાગાકાર).
- % (Modulo) : Returns the remainder after division (ભાગાકાર પછી વધેલી શેષ આપે છે). Used to check Even/Odd (Even/Odd ચેક કરવા વપરાય છે).
- ** (Power) : Used to find the exponent/power (ઘાત શોધવા માટે) (e.g., 2**3 = 8).
/ always returns a decimal result (હંમેશા decimal જવાબ આપે છે), while // removes the decimal point and returns only an integer (પોઈન્ટ કાઢીને માત્ર પૂર્ણાંક આપે છે).
2. Comparison (તુલનાત્મક)
👉 Used to compare values (કિંમતોની સરખામણી કરવા). The result is always True or False (જવાબ હંમેશા True અથવા False આવે છે). Mostly used to check conditions (શરતો ચેક કરવા સૌથી વધુ વપરાય છે).
Note: == is used for comparison (સરખામણી કરવા માટે છે), while = is used to assign a value (વેલ્યુ અસાઇન કરવા માટે છે).
3. Logical (લોજિકલ)
👉 Used to combine conditional statements (એક કરતા વધુ શરતો ભેગી કરવા).
and Password must be correct (બંને સાચા હોવા જોઈએ). If only one of the options is needed, or is used (જો બેમાંથી કોઈ એક જ ઓપ્શન જોઈતો હોય તો or વપરાય).
- and: Both conditions must be True (બંને શરતો True હોવી જરૂરી છે).
- or: At least one condition must be True (કોઈ એક શરત True હોય તો પણ ચાલે).
- not: Reverses the result (જવાબ ઊંધો કરી દે - True નું False).
4. Assignment (સોંપવું)
👉 Shortcut for updating a variable's value (વેલ્યુ અપડેટ કરવાનો શોર્ટકટ). This makes the code shorter and cleaner (આનાથી કોડ ટૂંકો અને ક્લીન બને છે).
5. Bitwise (બિટ લેવલ)
👉 Used to work directly on Binary numbers (0 & 1 પર સીધું કામ કરવા માટે). These operations are very fast (આ ઓપરેશન ખુબ ઝડપી હોય છે).
6. Membership & Identity
Membership (in, not in): Checks if a value is present inside a String, List, or Tuple (ચેક કરે છે કે કોઈ વેલ્યુ અંદર રહેલી છે કે નહિ).
Identity (is, is not): Checks if both variables point to the same memory location (ચેક કરે છે કે બંને વેલ્યુ એક જ મેમરી લોકેશન પર છે કે નહિ).
Note: x == z will be True because values are the same (કારણ કે વેલ્યુ સરખી છે), but x is z will be False because memory locations are different (કારણ કે મેમરી લોકેશન અલગ છે).
Try simple mathematical expressions or print statements:
Knowledge Test (MCQ Quiz)
Certificate Locked
Score 60% or more in the Knowledge Test above to get your certificate (સર્ટિફિકેટ મેળવવા માટે ઉપરની ક્વિઝમાં 60% કે તેથી વધુ માર્ક્સ લાવો).
Claim Your Certificate
Generate your certificate for completing the course (કોર્સ પૂરો કરવા બદલ તમારું સર્ટિફિકેટ જનરેટ કરો).

0 Comments