Day 6 - Python
👉Operators in Python

Hemant is a Microsoft certified SharePoint Administrator and Power platform developer with 16+ years extensive experience in IT, Microsoft SharePoint. He has decade involved providing M365 and SharePoint for business problems across nearly all industries and commercial sectors. Also he involved in Management/Leadership of Projects in Energy, Healthcare, Content Management, Mining domain, gaining extensive expertise in Project Lifecycle Management, Agile Development, DevOps Testing Cycle as well as Team Management
• Expertise in all aspects of the SharePoint Administration, installation, configuration, development, architecture, deployment and Migrations
• Experienced in developing collaboration and power platforms, portals, enterprise search, enterprise content management, business processes of SharePoint in large enterprise environments.
• Providing day-to-day administration and support on monitoring, usage and growth analysis and patching on SharePoint intranet and Internet.
• Adopting new technology and implementing them, in-depth functional knowledge with appreciation for technical skills.
• Have been involved in various phases of SDLC including analysis, design, coding, testing and implementation mainly Agile development
• Collaborated in governance development and processes, enhancing system efficiency and adherence to best practice. Improving SharePoint capabilities by evaluating and integrating third-party solutions
Programming and Scripting: Proficient in PnP PowerShell scripting for automation and customization.
Learn more about these cloud projects by visiting my portfolio at https://medium.com/@risbud
Technologies interested Cloud | MultiCloud | AWS | DevOps | Microsoft Azure | Google Cloud | Terraform | Ansible
In this assignment, you will explore various Python operators and their usage. Please complete the following tasks.
✍️Task 1: Arithmetic Operators
Create two variables
aandbwith numeric values.Calculate the sum, difference, product, and quotient of
aandb.Print the results.
# Arithmetic operators
a = 6
b = 9
print("Sum a + b:", (a+b) )
print("Sum a - b:", (a-b) )
print("Sum a * b:", (a*b) )
print("Sum a / b:", (a/b) )
Result:

✍️Task 2: Comparison Operators
Compare the values of
aandbusing the following comparison operators:<,>,<=,>=,==, and!=.Print the results of each comparison.
# comparison operators
a = 6
b = 9
print("Result a > b:", (a>b) )
print("Result a < b:", (a<b) )
print("Result a <= b:", (a<=b) )
print("Result a >= b:", (a>=b) )
print("Result a == b:", (a==b) )
print("Result a != b:", (a!=b) )
Results:

✍️Task 3: Logical Operators
Create two boolean variables,
xandyUse logical operators (
and,or,not) to perform various logical operations onxandy.Print the results.
# logical operators
x = -15
y = False
print("Result x and y:", (x & y) )
print("Result x or y:", (x | y) )
print("Result not x:", (not x) )
print("Result not y:", (not y) )
a = 10
b = 10
c = -10
if a > 0 and b > 0:
print("The numbers are greater than 0")
if a > 0 and b > 0 and c > 0:
print("The numbers are greater than 0")
else:
print("Atleast one number is not greater than 0")
a = 37
if not a:
print("Boolean value of a is True")
if not (a%3 == 0 or a%5 == 0):
print("10 is not divisible by either 3 or 5")
else:
print("10 is divisible by either 3 or 5")
Results:

✍️Task 4: Assignment Operators
Create a variable
totaland initialize it to 10.Use assignment operators (
+=,-=,*=,/=) to update the value oftotal.Print the final value of
total.
# assignment operators
a = 6
b = 9
a += b
print("Result a += b:", a)
a -= b
print("Result a -= b:", a)
a *= b
print("Result a *= b:", a)
a /= b
print("Result a /= b:", a)
a %= b
print("Result a %= b:", a)
a **= b
print("Result a **= b:", a)
a //= b
print("Result a //= b:", a)
Results:

✍️Task 5: Bitwise Operators (Optional)
- If you are comfortable with bitwise operators, perform some bitwise operations on integer values and print the results. If not, you can skip this task.
#Bitwise operators
a = 6
b = 9
a += b
print("Result a & b:", (a & b))
print("Result a | b:", (a | b))
print("Result a ^ b:", (a ^ b))
print("Result ~a:", (~a))
Results:

✍️Task 6: Identity and Membership Operators
Create a list
my_listcontaining a few elements.Use identity operators (`is` and
is not) to check if two variables are the same object.Use membership operators (`in` and
not in) to check if an element is present inmy_list.Print the results.
# membership operators
weekdays = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
days = weekdays
print("days is weekdays: ", (days is weekdays))
a = "hello"
b = "world"
print("a is not b: ", (a is not b))
print("Sunday is in weekdays: ", ("Sunday" in weekdays))
print("Iaitwar is in weekdays: ", ("Iaitwar" in weekdays))
print("Yellow not in weekdays:", ("Yellow" not in weekdays))
print("Yellow in weekdays:", ("Yellow" in weekdays))
Results:



