blob: d2e4a1d8d8786e55e4c699fc8511268647b8b137 [file] [log] [blame]
def run_custome():
print "class ...."
# print "my name is {0}".format("ehsan")
# age = 30
# if age > 30:
# print("welcome")
# elif age <= 30:
# print "not welcome"
# print range(0, 20, 2)
# for i in range(0, 20):
# print i
# number = "123,123,432,533,334"
# clean_number = ""
# array = ["ehsan", "yousefi"]
#
# for i in range(0, len(number)):
# if number[i] in "0123456789":
# clean_number += number[i]
# print clean_number
# i = 0
# while i < 20:
# print i
# i += 1
# list1 = [8, 2, 3, 8, 4, 2, 3, 5, 7]
# list1.append(9)
#
# print sorted(list1)
# print list1
#
# my_list = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"]
#
# my_iterator = iter(my_list)
#
# print my_iterator.next()
#
# for i in range(0, len(my_list) - 1):
# next_item = next(my_iterator)
# print next_item
#
# print('=' * 40)
#
# user = "ehsan yousefi", 25, "tehran"
#
# name, age, city = user
#
# print name
# print age
# print city
# my_dict = {
# "name": "ehsan",
# "last_name": "yousefi"
# }
# my_dict = {}
# my_dict["name"] = "ehsan"
# my_dict["city"] = "tehran"
# del my_dict["city"]
# # print my_dict.keys()
# for i in my_dict.keys():
# print my_dict[i]
#
# even = set([3, 3, "3", 3, 3])
# print(sorted(even))
# new test .....
if __name__ == "__main__":
run_custome()
# module_name,
# package_name,
# ClassName,
# method_name,
# ExceptionName,
# function_name,
# GLOBAL_CONSTANT_NAME,
# global_var_name,
# instance_var_name,
# function_parameter_name,
# local_var_name
def my_other_function(self):
print self
print "this is my function"
# class MyClass:
# name = ""
#
# def __init__(self, name="saber"):
# self.name = name
# print "init class ... "
#
# def my_function(self):
# print self
# print "this is my function"
# print self.name
#
#
# my_object = MyClass()
# # my_object.name = "ehsan"
# my_object.my_function()
# # my_other_function()
class Parent(object):
parent_name = ""
def get_parent_name(self):
print self.parent_name
class Child(Parent):
child_name = ""
def get_parent_name(self):
# super(Child, self).get_parent_name()
print "my parent name is not Hamid"
def get_child_name(self):
print self.child_name
child = Child()
print type(child)
# child.parent_name = "Hamid"
# child.child_name = "ehsan"
# child.get_child_name()
# child.get_parent_name()