Python Fourth Lesson Notes

Source: Internet
Author: User

How many times will the following code print "I love fish c!" ”

While ' C ':
Print (' I love Fish c! ')

Answer: Countless times

How many times will the following code print "I love fish c!" ”

i = 10
While I:
Print (' I love Fish c! ')
i = I-1


Answer: 10 times

Please write an expression equivalent to the < cost < 50

Ten < cost and cost < 50


Python3, can one line write multiple statements?

Answer: Can be separated by semicolons

Python3, can a statement be divided into multiple lines of writing?

A: You can use \ Continued line "() and so on can

How does Python's and operator differ from the C && operator? "This topic is for friends with C or C + + basics."


Ever heard of "short circuit logic (short-circuit logic)"?

operator Description Example
and Boolean "and"-if x is False,x and Y returns false, otherwise it returns the computed value of Y. (A and B) returns True.
Or Boolean "or"-if x is true, it returns true, otherwise it returns the computed value of Y. (A or B) returns true.
Not Boolean "Non"-returns False if X is true. If x is False, it returns true. Not (A and B) returns false.


Improve the second improvement requirement (provide users with three chance attempts, run out of opportunities, or exit loops for user guessing answers) and improve the code of the small turtle in the video.


This article is from the "Champion Small Lemon" blog, please make sure to keep this source http://lemonit.blog.51cto.com/6043645/1597853

Python Fourth Lesson Notes

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.