Blog Detail

September 1, 2023

Python Operators Exercises

  • How can we change the order of operations in an expression?



  • Which operator has higher precedence in Python?



  • Which operator has higher precedence in Python?



  • What is the output of this code?

                    a = 10
    b = 20
    c = 30
    
    d = a + b * c
    
    print(d)
  • What is the output of this code?

                    a = 1
    b = 2
    c = 3
    d = 4
    
    e = a + b * c + d
    
    print(e)
  • What is the output of this code?

                    a = 10
    b = 20
    c = 30
    
    d = (a + b) * c
    
    print(d)
    
  • What is the output of this code?

                    a = 1
    b = 2
    c = 3
    d = 4
    
    e = ((a + b) * c) + d
    
    print(e)
  • What is the output of this code?

                    a = 2
    b = 3
    c = 4
    
    d = a + b * c / a - b
    
    print(d)
  • What will be printed in the console?

                    x = 2
    y = 3
    z = 4
    
    print(x * y + z / x - y)
  • Python Exercises for Operators

    • If you’ve faced difficulties with these exercises, take a look at Operators Module on my Python course.


    You can also share ‘Python Operators’ Exercises on your:
    X (Twitter)TelegramLinkedinFacebook – or on your favorite platform…




    Happy Coding!
    Behnam Khani