python 笔记
来源:互联网 发布:劳拉克劳馥 知乎 编辑:程序博客网 时间:2024/06/05 17:47
我是要有多么无聊。
python 实现acm 1004问题。仅仅是实现。使用字典来处理。
def structdicts(Ballons,dicts):#遍历色彩球字符元组 for bas in Ballons: #如果字典中存在这个,那么值加1; if(dicts.has_key(bas)): dicts[bas]=dicts[bas]+1; #否则是新的,加入字典 else: dicts[bas]=1; #从字典中找到最多的那个def findMax(dicts): tempmax = 0; tempcolor = ''; for k in dicts: if(tempmax<=dicts[k]): tempmax=dicts[k]; tempcolor = k; print tempcolor;#定义字典TestDicts = dict();#色彩球定义 #TestBallons =['green','red','blue','red','red'];TestBallons =['green','red','blue','red','red','black','green','red','blue','red','red','black'];structdicts(TestBallons,TestDicts);findMax(TestDicts);
0 0
- Python笔记
- python笔记
- python笔记
- python笔记
- python笔记
- PYTHON笔记
- python笔记
- python笔记
- python笔记
- Python笔记
- Python笔记
- Python笔记
- PYTHON笔记
- Python笔记
- python笔记-------------
- python笔记
- Python笔记
- python 笔记
- (30 hackdays day 10) Material design - 可用的Material
- oracle
- [4]ARM-Linux S5PV210 UART驱动----串口驱动初始化过程
- 第一个注册机
- 01-windows游戏编程-框架
- python 笔记
- AS 通过URL 得到对应的Drawable资源
- C#之全局观
- (30 hackdays day 18) Dexlabs - 有语言的逆向分析服务
- nyoj 3 Binary String Matching
- (30 hackdays day 20) Clarify - 处于pending状态的QS服务
- Nginx 'rewrite or internal redirection cycle while internally redirecting' resulting in 500
- ubuntu 14.04lts 安装Myeclipse 2014及破解
- [5]ARM-Linux S5PV210 UART驱动----串口的open操作(tty_open、uart_open)