Pycent.com

Python B A S I C S Study the code and Answer the questions

Creator:TechBrainWaveAi.com
Session Number:
Attempt Number:

      def display_operations(a, b):
          """Function to display basic arithmetic operations between two numbers."""
          print(f"Sum of {a} and {b} is: {a + b}")
          print(f"Product of {a} and {b} is: {a * b}")
          if b != 0:
              print(f"Division of {a} by {b} is: {a / b}")
          else:
              print("Cannot divide by zero!")
      
      def swap_and_check(a, b):
          """Swap two numbers and check the new values with basic conditions."""
          print(f"Original values: a = {a}, b = {b}")
          a, b = b, a
          print(f"Swapped values: a = {a}, b = {b}")
      
          # Checking conditions
          if a > b:
              print(f"{a} is greater than {b}")
          else:
              print(f"{b} is greater than {a}")
      
          return a, b
      
      # Main execution starts here
      a, b = 13, 11
      display_operations(a, b)  # Display basic arithmetic operations before swapping
      a, b = swap_and_check(a, b)  # Swap values and check conditions
      
      # Additional example of modulus operation
      print(f"Modulus of {a} by {b} (remainder): {a % b}")
      
      
        
Merit: 0