0

Can anyone correct the following code

def sliceit(mylist): # Write your code here list=int(input("enter numbers")) print("list:\t",list) #print second and third element mylist=list[1:3] print("mylist:\t",mylist) # print third indexed elements mylist=list[1:10:2] print("mylist:\t",mylist) #print last three elements in reversed order mylist=list[-1:-4:-1] print("mylist:\t",mylist) if __name__ == '__main__': mylist_count = int(input().strip()) mylist = [] for _ in range(mylist_count): mylist_item = input() mylist.append(mylist_item) sliceit(mylist)

27th Jul 2020, 6:58 PM
Suresh Kumar
Suresh Kumar - avatar
2 Antworten
- 1
Suresh Kumar It seems this is a copied code from any site, can you share its link?
27th Jul 2020, 7:26 PM
David