day4-"Python Functions"

Source: Internet
Author: User

Tag: print also has parentheses otherwise BSP input Python python function definition

One, the heart chicken soup:

Jingliyang Quotes:

1, as long as you today than yesterday's you have progress, that is progress.

2, smart and stupid is only relative, you are smarter than you are smarter, you are not stupid is the most stupid.

Second, the simple function exercises:

A simple description of the Python function:

The so-called function, in fact, is to encapsulate some functions, used in the subsequent call.

User input number 0-100
Program Judgment:
Digital >90, score of a
Digital >80, score B
Digital >60, score C
Digital <60 with a score of D
Trying to do it with a function?

def yyy (score):   # defines a function with the name yyy, and the value in parentheses can be any other name.    if score > score < 0:  # Determine if the number entered is greater than 100 or less than 0        print (' illegal ')    elif score >=: #当输入的数字大于等于90分时        print (' A ')    elif score >=: #当输入的数字大于等于80分时        print (' B ')    elif score >=: #当输入的数字大等于于70分时        print (' C ')    elif score >=: #当输入的数字大于等于60分时        print (' C ')    else:                  # otherwise less than 60 tick        print (' D ') while True:             # Let the user loop output an integer    score = int (input (' score: '))     yyy (Score)          # when calling the function, use the function body name in parentheses. The name in the parentheses must correspond to the variable name of the input value.

day4-"Python Functions"

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.