Created
March 11, 2016 08:04
-
-
Save FGFW/20783d8b6e893c241511 to your computer and use it in GitHub Desktop.
python解无忧公主数学题107.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| python解无忧公主数学题107.py | |
| http://mp.weixin.qq.com/s?__biz=MzI5ODEwMDQyNw==&mid=402343371&idx=1&sn=0de458a3653a0070ba3912bda7d01db9&scene=25#wechat_redirect | |
| 2016年3月9日 12:49:55 codegay | |
| """ | |
| def ff1(): | |
| #用程序自动把index对应位置的数字切出来。 | |
| exp=990*991*992*993 | |
| s="966428A91B40" | |
| #问AB=多少 | |
| ab=str(exp)[s.index("A")]+str(exp)[s.index("B")] | |
| print("方法1: AB =",ab) | |
| #2016年3月9日 13:03:02 | |
| ff1() | |
| def ff2(exp=996*997*998*999,s="9900x4yz0024"): | |
| #2016年3月11日 13:32:03 | |
| #本函数目的设计成可以用来解同类题型,输入一个表达式,算出其结果部分被字母打码的值。 | |
| abc=''.join([r for r in s if r.isalpha()]) | |
| v=''.join([str(exp)[s.index(r)] for r in s if r.isalpha()]) | |
| print("方法2结果:",abc,"=",v) | |
| #2016年3月11日 14:11:58 | |
| ff2() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment