Python3 and Python3

Source: Internet
Author: User

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! ')

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.