Given an integer choice denoting the choice of the user and a list containing the single value R or two values L and B depending on the choice.
If the user's choice is 1, calculate the area of the circle having the given radius(R).  
Else if the choice is 2, calculate the area of the rectangle with the given length(L) and breadth(B).
Example 1:
Input: 
choice = 1, 
R = 5
Output: 78.53981633974483
Explaination: The choice is 1. 
So we have to calculate the area of the circle.
Example 2:
Input: 
choice = 2, 
L = 5, B = 10
Output: 50
Explaination: Here we have to calculate the 
area of the rectangle.
Your Task:
You do not need to read input or print anything. Your task is to complete the function switchCase() which takes choice and a list arr[], containing the single value R or the two values L and B, as input parameters. It should return the area of the desired geometrical figure.
Note: Use Math.PI for the value of pi.
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ R, L, B ≤ 100

Source: geeksforgeeks | Difficulty: EASY

Starter code: #User function Template for python3



class Solution:

    def switchCase(self, choice, arr):

        # Code here

Solutions:
class Solution:

	def switchCase(self, choice, arr):
		import math
		if choice == 1:
			r = arr[0]
			k = arr[0]
			return math.pi * r * k
		elif choice == 2:
			l = arr[0]
			b = arr[1]
			return l * b


from math import pi

class Solution:

	def switchCase(self, choice, arr):
		if choice == 1:
			return pi * arr[0] * arr[0]
		else:
			return arr[0] * arr[1]


import math

class Solution:

	def switchCase(self, choice, a):
		if choice == 1:
			return math.pi * arr[0] * arr[0]
		elif choice == 2:
			return arr[0] * arr[1]
		else:
			return -1


class Solution:

	def switchCase(self, ch, arr):
		import math
		if ch == 1:
			return float(math.pi * arr[0] * arr[0])
		if ch == 2:
			return arr[0] * arr[1]


import math

class Solution:

	def switchCase(self, choice, arr):
		if choice == 1:
			r = arr[0]
			return math.pi * r * r
		else:
			l = arr[0]
			b = arr[1]
			return l * b


from math import pi

class Solution:

	def switchCase(self, choice, arr):
		if choice == 1:
			value = pi * arr[0] * arr[0]
		elif choice == 2:
			value = arr[0] * arr[1]
		return value


import math

class Solution:

	def switchCase(self, choice, arr):
		if choice == 1:
			var = arr[0]
			return var * math.pi * var
		elif choice == 2:
			var_1 = arr[0]
			var_2 = arr[1]
			return var_1 * var_2


class Solution:

	def switchCase(self, choice, arr):
		if choice == 1:
			return 3.141592653589793 * arr[0] * arr[0]
		elif choice == 2:
			return arr[0] * arr[1]


import math

class Solution:

	def switchCase(self, choice, arr):
		res = 0
		if choice == 1:
			res = math.pi * arr[0] * arr[0]
		elif choice == 2:
			res = arr[0] * arr[1]
		return res


import math

class Solution:

	def switchCase(self, choice, arr):
		if choice == 1:
			R = arr[0]
			return math.pi * R * R
		if choice == 2:
			L = arr[0]
			B = arr[1]
			return L * B


import math

class Solution:

	def switchCase(self, choice, arr):
		pp = math.pi
		if choice == 1:
			s = pp * arr[0] * arr[0]
			return s
		else:
			return arr[0] * arr[1]


import math

class Solution:

	def switchCase(self, choice, arr):
		if choice == 1:
			radius = arr[0]
			area = math.pi * radius * radius
		elif choice == 2:
			length = arr[0]
			breadth = arr[1]
			area = length * breadth
		else:
			area = -1
		return area


import math

class Solution:

	def switchCase(self, choice, arr):
		area = 0
		if choice == 1:
			R = arr[0]
			area = math.pi * R * R
		elif choice == 2:
			l = arr[0]
			b = arr[1]
			area = l * b
		return area


import math

class Solution:

	def switchCase(self, choice, arr):
		if choice == 1:
			return math.pi * arr[0] * arr[0]
		elif choice == 2:
			return arr[0] * arr[1]
		else:
			return 'Input choice should be either 1 or 2'


import math

class Solution:

	def switchCase(self, choice, arr):
		method_name = 'element' + str(choice)
		method = getattr(self, method_name, lambda : 'not a binary digit')
		return method()

	def element1(self):
		arr1 = float(arr[0])
		return math.pi * arr1 * arr1

	def element2(self):
		return arr[0] * arr[1]


class Solution:

	def switchCase(self, choice, arr):
		if choice == 1:
			Pi = 3.141592653589793
			arr[0] = float(arr[0])
			return Pi * arr[0] * arr[0]
		else:
			return arr[0] * arr[1]


import math as m

class Solution:

	def switchCase(self, choice, arr):
		if choice == 1:
			return m.pi * arr[0] * arr[0]
		elif choice == 2:
			return arr[0] * arr[1]