Posts

Showing posts from September 28, 2021

Reversing a List in Python

  Reversing a List in Python Code - --------------------- # Reversing a list # Method 1 f = [ 1 , 3 , 4 , 5 , 6 , 6 , 7 , 43 , 3 , 5 , 45 ] f = [i for i in reversed (f)] print (f) # Method 2 f.reverse() print (f)

I made a to do list system in python.

  To do list system in python Code -  ------------------------------------ def main_function (): """This function basically add and remove your task from a list..""" to_do_list = [] while ( True ): a = input ( "What you want to do? \n 1- Adding elements in to do list. \n 2- Have completed a task in to do list.. \n 3- To show to do list. \n " ) if a == '1' : while ( True ): element = input ( "Enter the task which you want to add in to do list: " ) to_do_list.append(element) opinion = input ( "Wanna add one more task then press enter otherwise enter 1: " ) if opinion == '' : continue else : break elif a == '2' : while ( True ): print (to_do_list) remove_element = int ( input ( "Enter the inde...