bash assign a variable the result of a series of commands code example

Example 1: store result of command in variable bash

variable=$(command [option…] argument1 arguments2 …)

Example 2: excanging value of two variable in python

# Python program to swap two variables

x = 5
y = 10

# To take inputs from the user
#x = input('Enter value of x: ')
#y = input('Enter value of y: ')

# create a temporary variable and swap the values
temp = x
x = y
y = temp

print('The value of x after swapping: {}'.format(x))
print('The value of y after swapping: {}'.format(y))