pythonchallenge 3 off

2010-07-20  来源:本站原创  分类:Python  人气:165 

3 Guan Address

Conditions were selected according to the following characters: its own lowercase letters, it is exactly the left and right sides of the three capital letters (no more and no less)

My solution:

# -*- coding=utf-8 -*-
'''
Created on 2010-7-20

@author: Administrator
'''
import string
print string.ascii_lowercase
out = ""

f = file("equality.text", "r")
text = ""
while 1:
    l = f.readline()
    if l:
        text += l
    else:
        break

for i in range(len(text)):
    if i > 2 and i < len(text) - 2 and (text[i] in string.ascii_lowercase
        and text[i - 1] in string.ascii_uppercase
        and text[i - 2] in string.ascii_uppercase
        and text[i - 3] in string.ascii_uppercase
        and text[i - 4] not in string.ascii_uppercase
        and text[i + 1] in string.ascii_uppercase
        and text[i + 2] in string.ascii_uppercase
        and text[i + 3] in string.ascii_uppercase
        and text[i + 4] not in string.ascii_uppercase):
        out += text[i]
        print i, text[i], text[i - 1], text[i - 2], text[i - 3], text[i + 1], text[i + 2], text[i + 3]
    else:
        continue

print out

Implementation of the procedure output: linkedlist

Since that code is too poor to directly see the answer:

3 relevant answers to address (note, only after you enter the fourth off to have the power to see the third, the answer)

Read other people's answers to feel with regular expressions is the best way to:

>>> import re
>>> "".join(re.findall('[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]', text))
'linkedlist'

Another point we should review the case to judge whether the character the way:

text[i ] .islower()

To the next level: the fourth off Address

相关文章
  • pythonchallenge challenges (from the third closed) 2010-05-15

    After some time learning ruby, but also learned a period of time python, learn python time, want to learn ruby, and had originally intended to use python Gao Ge C / S software, learning a long time before there is no address found python3 the library

  • pythonchallenge 4 off 2010-07-21

    4 Guan Address Direct point of the page where the picture will appear: and the next nothing is 92512 This time the address bar displays the address: http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=12345 The data back to the page displaye

  • pythonchallenge 6 related 2010-07-21

    6 Guan Address Only one page to connect to the PayPal link, looked at the page source code, the authors say the link below just want users to donate, there is a top Notes: <html> <!-- <-- zip --> <head> <title>now there are pair

  • pythonchallenge 7 off 2010-07-21

    7 off In addition to a picture nothing, but the chart above there is a strip, a bit like a bar code (bar the width of the distribution is unequal, the color shades of gray color blocks). Page title is the smarty, looked at the page source code do not

  • pythonchallenge 12 off 2010-07-22

    12 off And the last one off the same map and the title is the only message, entitled: dealing evil Pictures are also a bit vague, but can see there are individuals playing cards, In this off the face of unprecedented difficulties, because the image f

  • pythonchallenge 13 off 2010-07-23

    13 off: call him Clue 1: phone that evil Clue 2: the above pictures of the phone number "5", open phonebook.php page, shows a xml error: <methodResponse> <fault> <value> <struct><member><name>faultCode</nam

  • pythonchallenge answer 2010-08-06

    Test related 2<<37 Level 1 import string str="g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc

  • 记录 pythonchallenge.com 解题url 2012-12-05

    pythonchallenge.com是个用python解迷的有趣网站,当然你用其它语言也能解. 记录下解题后的各关地址: 0. http://www.pythonchallenge.com/pc/def/0.html 1. http://www.pythonchallenge.com/pc/def/map.html 2. http://www.pythonchallenge.com/pc/def/ocr.html 3. http://www.pythonchallenge.com/pc/def

  • pythonchallenge off 0 2010-06-07

    For addresses 0 solution: 1<<38 274877906944L To next address

  • pythonchallenge level 1 2010-06-07

    Level 1 address My method: src = "g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj." trans

  • pythonchallenge 2 off 2010-06-07

    2 off Address: import string out = "" with open('1.text', 'r') as f: s = f.read() for c in s: if c in string.ascii_letters: out += c print out The answer addresses 3 off Summary: >>> import string >>> filter(lambda x: x in stri

  • pythonchallenge 3 off 2010-07-20

    3 Guan Address Conditions were selected according to the following characters: its own lowercase letters, it is exactly the left and right sides of the three capital letters (no more and no less) My solution: # -*- coding=utf-8 -*- ''' Created on 201

  • pythonchallenge 8 off 2010-07-21

    8 off Picture is a little bee, little bee will be prompted to click on so that we enter a user name and password. So this is what I need to solve the problem. Look at the page's source code, the bottom there is a line comment: <!-- un: 'BZh91AY&SYA

  • pythonchallenge 9 related 2010-07-21

    9 off Page is only a picture, no text, no hyperlinks, drawing a lot of points above, look at the source file, the bottom gives some information: <! - first + second =? first: 146,399,163,403,170,393,169,391,166,386,170,381,170,371,170,355,169,346,167

  • pythonchallenge 10 off 2010-07-22

    10 off Photo below a line of information, ask: len (a [30]) =? Click the picture to the cattle, to see: a = [1, 11, 21, 1211, 111221, Show that this is the projection series, my IQ is too low, like the Lao Bantian did not find the law of series, Baid

  • pythonchallenge 11 off 2010-07-22

    11 off In addition to a plan other than the page, no hyperlinks, no written description, source code, no comments. The page title is: odd, even (parity) Looks like that from the start with the map, and read other people's tips under, that is to separ

  • pythonchallenge 14 off 2010-07-23

    14 off: walk around Clue 1: the body of the page with a named wire most of the pictures, looks a bit like a bar code, downloaded opened it is a horizontal line (10000X1 pixels) Clue 2: page source code have the following comments remember: 100*100 =

  • pythonchallenge 15 off 2010-07-26

    15 off: whom? Clue 1: Title whom? (Who) Clue 2: the picture is a calendar that says January 1 6, black box, a drop of ink to be covered up Clue 3: 1 * 6 years on January 1 is Thursday Clue 4: January 26 is ring up Clue 5: source code in two comments:

  • pythonchallenge 16 off 2010-07-26

    16 off: let me get this straight Clue 1: Only picture Clue 2: the picture has a lot of horizontal pink (195) of small short-term, if not every small short-term in the same row Analysis: The title means that these little pink on short-term in a direct

  • pythonchallenge - lev 01 2010-08-05

    print(2**38) Results :274877906944