Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #QUE 1
- def numberListInput(list_of_names):
- for x in range(len(list_of_names)):
- print(x+1, list_of_names[x]) # x+1 because numbering starts with 0
- #Que 2.1
- def factorial(number):
- fact = 1
- for x in range(number):
- fact = fact * (x+1)
- return fact
- #Que 2.2
- def factorialFrom1toN(N):
- for x in range(N):
- print(factorial(x+1))
- def checkCircular(list1, list2):
- if len(list1) != len(list2):
- return False
- while list1[0] !=
- #QUE 3
- def circularly_identical(list1, list2):
- # doubling list
- list3 = list1 * 2
- # traversal in twice of list1
- for x in range(0, len(list1)):
- z = 0
- # check if list2 == list1 curcularly
- for y in range(x, x + len(list1)):
- if list2[z]== list3[y]:
- z+= 1
- else:
- break
- # if all n elements are same circularly
- if z == len(list1):
- return True
- return False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement