diff --git a/.gitignore b/.gitignore index c10666e229d..e633ef1ee77 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,17 @@ .idea *.pyc +string=sorted(input()) +lower="" +even="" +odd="" +upper="" +for i in string: + if i.islower(): + lower+=i + elif i.isupper(): + upper+=i + elif int(i)%2==0: + even+=i + else: + odd+=i +print(lower+upper+odd+even) diff --git a/Counting-sort.py b/Counting-sort.py index e1cd1819377..9bb7e782968 100644 --- a/Counting-sort.py +++ b/Counting-sort.py @@ -1,9 +1,7 @@ #python program for counting sort (updated) n=int(input("please give the number of elements\n")) -tlist = list() -print("okey now plase give the elemets") -for i in range(n): - tlist.append(int(input("\n"))) +print("okey now plase enter n numbers seperated by spaces") +tlist=list(map(int,input().split())) k = max(tlist) n = len(tlist) diff --git a/Print_List_of_Even_Numbers.py b/Print_List_of_Even_Numbers.py index ca471bf717e..ed0a83f3525 100644 --- a/Print_List_of_Even_Numbers.py +++ b/Print_List_of_Even_Numbers.py @@ -1,3 +1,9 @@ +# Very sort method to creat list of even number form a given list +#Advance-Python +list_number=list(map(int,input().split())) +even_list=[i for i in list_number if i%2==0] +print(even_list) +exit()# Another one n = int(input("Enter the required range : ")) # user input list = [] diff --git a/Print_List_of_Odd_Numbers.py b/Print_List_of_Odd_Numbers.py index 583a2f25dce..e13969f4b1f 100644 --- a/Print_List_of_Odd_Numbers.py +++ b/Print_List_of_Odd_Numbers.py @@ -1,4 +1,15 @@ +master +#Another best method to do this + +n=map(list(int,input().split())) +odd_list=list(i for i in n if i%2!=0) +print(odd_list) +exit() + +# CALCULATE NUMBER OF ODD NUMBERS + # CALCULATE NUMBER OF ODD NUMBERS WITHIN A GIVEN LIMIT +master n = int(input("Enter the limit : ")) # user input