blob: d2e4a1d8d8786e55e4c699fc8511268647b8b137 [file] [log] [blame]
Ehsan Yousefi30d96d62019-03-12 14:30:10 +03301def run_custome():
2 print "class ...."
3 # print "my name is {0}".format("ehsan")
4 # age = 30
5 # if age > 30:
6 # print("welcome")
7 # elif age <= 30:
8 # print "not welcome"
9 # print range(0, 20, 2)
10 # for i in range(0, 20):
11 # print i
12 # number = "123,123,432,533,334"
13 # clean_number = ""
14 # array = ["ehsan", "yousefi"]
15 #
16 # for i in range(0, len(number)):
17 # if number[i] in "0123456789":
18 # clean_number += number[i]
19 # print clean_number
20
21 # i = 0
22 # while i < 20:
23 # print i
24 # i += 1
25
26 # list1 = [8, 2, 3, 8, 4, 2, 3, 5, 7]
27 # list1.append(9)
28 #
29 # print sorted(list1)
30 # print list1
31 #
32 # my_list = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"]
33 #
34 # my_iterator = iter(my_list)
35 #
36 # print my_iterator.next()
37 #
38 # for i in range(0, len(my_list) - 1):
39 # next_item = next(my_iterator)
40 # print next_item
41 #
42 # print('=' * 40)
43 #
44 # user = "ehsan yousefi", 25, "tehran"
45 #
46 # name, age, city = user
47 #
48 # print name
49 # print age
50 # print city
51
Ehsan Yousefi30d96d62019-03-12 14:30:10 +033052 # my_dict = {
53 # "name": "ehsan",
54 # "last_name": "yousefi"
55 # }
56 # my_dict = {}
57 # my_dict["name"] = "ehsan"
58 # my_dict["city"] = "tehran"
59 # del my_dict["city"]
60 # # print my_dict.keys()
61 # for i in my_dict.keys():
62 # print my_dict[i]
63 #
64 # even = set([3, 3, "3", 3, 3])
65 # print(sorted(even))
66
Ehsan Yousefi30d96d62019-03-12 14:30:10 +033067 # new test .....
68
69
70if __name__ == "__main__":
71 run_custome()
72
Ehsan Yousefiece77d12019-03-13 14:55:37 +033073
Ehsan Yousefi30d96d62019-03-12 14:30:10 +033074# module_name,
75# package_name,
76# ClassName,
77# method_name,
78# ExceptionName,
79# function_name,
80# GLOBAL_CONSTANT_NAME,
81# global_var_name,
82# instance_var_name,
83# function_parameter_name,
84# local_var_name
Ehsan Yousefiece77d12019-03-13 14:55:37 +033085
86
87def my_other_function(self):
88 print self
89 print "this is my function"
90
91
92# class MyClass:
93# name = ""
94#
95# def __init__(self, name="saber"):
96# self.name = name
97# print "init class ... "
98#
99# def my_function(self):
100# print self
101# print "this is my function"
102# print self.name
103#
104#
105# my_object = MyClass()
106# # my_object.name = "ehsan"
107# my_object.my_function()
108# # my_other_function()
109
110
111class Parent(object):
112 parent_name = ""
113
114 def get_parent_name(self):
115 print self.parent_name
116
117
118class Child(Parent):
119 child_name = ""
120
121 def get_parent_name(self):
122 # super(Child, self).get_parent_name()
123 print "my parent name is not Hamid"
124
125 def get_child_name(self):
126 print self.child_name
127
128
129child = Child()
130print type(child)
131# child.parent_name = "Hamid"
132# child.child_name = "ehsan"
133# child.get_child_name()
134# child.get_parent_name()