Stupid way to learn Python (26)

Source: Internet
Author: User

Exercise 26: Congratulations, you can take the exam now!

You've almost finished the first half of the book, but the latter part is more interesting. You will learn logic and use conditional judgments to implement useful functions.

You have a question to do before you go on with your study. This question is difficult because it requires you to correct the code written by someone else. When you become a programmer, you will often have to face the code of other programmers, and perhaps their arrogant attitude, they will often say their code is perfect.

Such a programmer is a fool who thinks he doesn't care about others. Good scientists will be skeptical about their own work, as well as good programmers who will assume that their code is always in error, and that they will start by assuming that they have problems with their code, and then using the exclusion method to check out all the things that may be their problem, and finally come to the conclusion that this is someone else's fault.

In this exercise, you will face a poorly-level programmer and change his code. I randomly copied exercises 24 and 25 into a file, deleted some of the characters at random, and then added some bugs in. Most of the error is that Python will tell you when it executes, and there are some arithmetic errors you want to find out for yourself. All that's left is formatting and spelling mistakes.

All of these errors are easily made by programmers, even if experienced programmers are no exception.

Your task is to modify this file correctly and use all your skills to improve the script. You can analyze the file first, or you can print it like a term paper, fix every flaw in it, repeat the correction, and run the action until the script works perfectly. Don't ask for help throughout the process, and if you're stuck somewhere that can't go on, take a break and do it later.

Even if you need a few days to complete, do not give up until completely changed.

Finally, the purpose of this exercise is not to write the program, but to correct the existing program, you need to visit the following Web site:

    • Http://learnpythonthehardway.org/exercise26.txt

Copy and paste the code from there, named ex26.py, which is the only place in the book that allows you to copy and paste.

Stupid way to learn Python (26)

Related Article

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.