Python3 and Python3
Sequence 1: these are collectively referred to as Sequences Based on the commonalities of lists, tuples, and strings (they are all brothers). 1) Each element can be indexed. 2) the default index values start from scratch (Python also supports negative Index). 3) You can obtain a new string by sharding (slicing). 4) they all have the same operators (repeated operators, Concatenation Operators, and member relationship operators). 2. Related built-in Function Iteration concepts:
Iteration is an activity that repeats the feedback process. Its purpose is generally to approach the desired goal or result. Each repetition of a process is called an "iteration", and the result of each iteration is used as the initial value of the next iteration.
Repeats a subroutine * (a group of commands) that needs to be repeatedly executed in a specific program of a computer, that is, repeats the loop in the program until a certain condition is met, also known as iteration.
Built-in functions
3. Customize a function to complete the min () function
def minu(x): x=x[0] for each in x: if x<each: x=each return x
4. Define the sum () function and ignore the strings in the parameter.
def sumd(x): sum2=0 for each in x: if type(each)== int or type(each)==float: sum2+=int(each) else: continue print('sum=',sum2) 5. Check the score
# Name = input ('Enter the user name to be searched: ') score = [['fa Ming Jia', 100], ['ding ding', 80], ['Aunt ', 65], ['risz', 95], [aizh', 90] IsFind = Falsefor each in score: # each is the list in the score (list) if name in each: # name IS the print (name + ') element of the list :', each [1]) IsFind = True break if IsFind = False: print ('The queried data does not exist! ')