python-practice questions

#!/usr/bin/python 
# _*_ coding : utf8 _*_
# Author :army.han

# #99Multiplication table
# for i in range(1,10):
# for j in range(1,i+ 1):
# print(j,"*" ,i, "=",j*i,sep="",end=" ")
# print("\n")
#
# #Fibonacci sequence
#
# a,b = 0,1
# while b < 1000:
# print(b)
# a,b= b, a+b
#
# #5 cents for males, 3 cents for hens, and 3 cents for chickens Buy 100 chickens for 100 cents for 100 cents
# for g in range(1,100//5):
# for m in range(1,100//3):
# for x in range(1,100):
# if g + m + x ==100 and g*5 + m*3 + x/3 ==100:
# print(g,m,x)
#
# #Tuple use enumrete to output elements and numbers
# tu = ("han","li","jiang")
# for h,y in enumerate(tu,10):
# print(h,y)
#
# # #There
is a list to find two elements that add up to 9
# mu = [2,7,11,15,1, 8,7]
#
# idx =[]
# new =[]
# for i in mu:
# for j in mu:
# if i+j == 9:
# new.append((i,j)) #here (i, j) as an element
# idx.append((mu.index(i), mu.index(j))) #Index in the combination
# print(new)
# print(idx) #Generate

200 pieces of data , according to user input paging display
us_li=[]
for i in range(1,202):
da = {"name":"han"+str(i),"Email":"han"+str(i)+".@ qingyi.com","passwd":"passwd"+str(i)}
us_li.append(da)

while True:
shu = input("Please input 1..21:").strip()
s = int(shu)
start = (s-1) * 10
end = s * 10
res = us_li[start:end]

for item in res:
print(item,type(item))

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326371451&siteId=291194637