name = "itheima"
length = len(name)
print(length)
str_1 = "python"
count = 0
def my_len(str):
global count
for i in str:
count+=1
print(f"字符串{str}的长度是:{count}")
my_len(str_1)
my_list = ["itheima","itcast","python"]
print(my_list)
print(type(my_list))
my_list = ["itheima",666,True]
print(my_list)
print(type(my_list))
my_list = [[1,2,3],[4,5,6]]
print(my_list)
print(type(my_list))
name_list = ['Tom','The Shy','Rookie']
print(name_list[0])
print(name_list[1])
print(name_list[2])
print(name_list[-1])
print(name_list[-2])
print(name_list[-3])
my_list = [[1,2,3],[4,5,6]]
print(my_list[1][1])
my_list = ["itheima","itcast","python"]
index = my_list.index("itheima")
print(index)
my_list[0] = "hahahaha"
print(my_list)
my_list.insert(1,"ning")
print(my_list)
my_list.append("黑马程序员")
my_list.extend([1,2,3])
print(my_list)
del my_list[2]
print(my_list)
my_list.pop(2)
my_list.remove("hahahaha")
print(my_list)
my_list.clear()
my_list = ["itheima","itcast","itheima","python"]
count = my_list.count("itheima")
print(count)
len = len(my_list)
print(len)
def list_while_finc():
my_list = ["hema","黑马程序员","Python"]
index = 0
while index < len(my_list):
element = my_list[index]
print(element)
index+=1
def list_for_func():
my_list = [1,2,3,4,5]
for i in my_list:
print(i)
list_while_finc()
list_for_func()