Answer:
Following are the code to this question:
Defining method shiftLeft:
def shiftLeft(bit_string): #defining method shiftLeft, that accepts parameter bit_string
bit_string= bit_string[1:]+bit_string[0]#use bit_string to provide slicing
return bit_string#return bit_string value
bit_string =input("Enter value: ")#defining bit_string variable for user input
print (shiftLeft(bit_string))#use print method to call shiftLeft method
Defining method shiftRight:
def shiftRight(bit_string):#defining method shiftRight, which accepts bit_string variable
bit_string=bit_string[len(bit_string)-1]+bit_string[0:len(bit_string)-1]#using bit_string variable for slicing
return bit_string#return bit_string calculated value
bit_string= input("Enter value: ")#defining bit_string variable for user input
print(shiftRight(bit_string))#use print method to call shiftLeft method
Output:
Please find the attachment.
Step-by-step explanation:
method description:
- In the above-given python code two methods "shiftLeft and shiftRight" are declared, in which both the method accepts a string variable "bit_string".
- Inside methods, we use the slicing, in which it provides to use all the sequence values and calculated the value in this variable and return its value.
- At the last step, the bit_string variable is used to input value from the user end and call the method to print its value.