Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def split_in_two(list,number): #declares a split_in_two function
- a = list[2:] #assingns a variable a to that prints the list from index 2 till the end of the list
- b = list[0:2] #assigns a variable b that prints the list from index 0 to 1
- if number % 2 == 0: #checks if the number is an even number
- print(a) #prints a if the number is even
- else:
- print(b) #if it is odd it prints b
- list = ["a","b","c","d","e","f"] #assings the list to the variable list
- split_in_two(list,4) #calls the fuction split_in_two
- split_in_two(list,3) #calls the function split_in_two
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement