Holes in the text Add problem to Todo list problem code:holes

Source: Internet
Author: User

1 ImportSYS2 3 4 defcount_holes (letter):5hole_2 = ['A','D','O','P','Q','R']6     ifLetter = ='B':7         return28     elifLetterinchhole_2:9         return1Ten     Else: One         return0 A  -  - defMain (): then =Int (sys.stdin.readline ()) -      forTinchSys.stdin: -num =0 -          forLinchT[:-1]: +num + =count_holes (L) -         PrintNum +  A  atMain ()

Learn

Raw_input () and sys.stdin.readline () differences

Raw_input () does not contain the last \ n line-break symbol, and the latter has

Sys.stdin.readline (). Strip (), no parameters, default strip trailing, newline

. spilt () plus one, according to the space, the input data is divided

Ide

The understanding of Debug

Console input cannot be immediately echoed

Because the pycharm enabled buffering, in order to efficiently

Psyco.full ()

Sometimes it does cause re

Good code indentation and whitespace

Pre-defined way faster

If a in b[]

For loop

No problem, you can loop a string, if you do not want \ n (the subject does not affect the result, but more than once the function call), with [:-1], this: operation is py a great advantage

This idea and commissioning are done independently.

Come on!

Error
Elif (' A ' or ' D ' or ' O ' or ' P ' or ' Q ' or ' R ') = = Letter: Logical judgment is wrong, cannot judge a after, cannot use

  

  

Holes in the text Add problem to Todo list problem code:holes

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.