New Microsoft Word Document2
New Microsoft Word Document2
# # Eg 2: 6
# # Output : 6, 3, 0, -3, -610
# # a=int(input("enter the number"))
# # # def rec_sum(a_1, d, n):
# # def ap(n):
# # return (ap(n))
# # while a>=-a:
# # print(ap(a))
# # a=a-3
# # here="/home/httpd/html/test"
# # print(here.split('/')[2])
# # if ('-1'):
# # print("ouch")
# # else:
# # print("echo")
# # import sys
# # print(sys.version_info)
# # if 1 < 3 < 3:
# # print(1)
# # print(2)
# # print(3)
# # a = dict(x=1, y=2, z=3)
# # b = {'x': 1, 'y': 2, 'z': 3}
# # c = dict(zip(['x', 'y', 'z'], [1, 2, 3]))
# # d = dict([('y', 2), ('x', 1), ('z', 3)])
# # e = dict({'z': 3, 'x': 1, 'y': 2})
# # print(a)
# # print(b)
# # print(c)
# # print(d)
# # print(e)
# # a=3
# # a = a + True - False + True
# # print(a)
# # HTML
# import sys
# filein = open(sys.argv[1], "r")
# fileout = open("table.html", "w")
# data = filein.readlines()
# table = "<table>\n"
# header = data[0].split(",")
# table += " <tr>\n"
# for column in header:
# table += " <th>{0}</th>\n".format(column.strip())
# table += " </tr>\n"
# for line in data[1:]:
# row = line.split(",")
# table += " <tr>\n"
# for column in row:
# table += " <td>{0}</td>\n".format(column.strip())
# table += " </tr>\n"
# table += "</table>"
# fileout.writelines(table)
# fileout.close()
# filein.close()
# a="sunil\'s"
# def single(z):
# c="#"
# for i in z:
# if i== "\'" :
# return "#"
# else:
# return i
# b=""
# for j in a:
# b=b+single(j)
# print(b)
list=['a','bb','dddd','ccc']
# list.sort()
# print(list)
# def sort(list):
# list.sort(key=len)
# return list
# print(Sorting(list))
def sort(lst):
if not lst:
return []
return (sort([x for x in lst[1:] if x < lst[0]])
+ [lst[0]] +
sort([x for x in lst[1:] if x >= lst[0]]))
print(sort(list))