• 考试一









    
    '''
    16,实现一个整数加法计算器:(6分)            
    如:content = input(‘请输入内容:’)  # 如用户输入:5+8+7....(最少输入两个数相加),然后进行分割再进行计算,将最后的计算结果添加到此字典中(替换None):
    dic={‘最终计算结果’:None}。
    
    '''
    # content = input('请输入内容:')  # 5+8+7。。。
    # content_list = content.split('+')
    # print(content_list)
    # sum = 0
    # for i in content_list:
    #     sum = sum + int(i)
    # print(sum)
    
    # i = '7       '
    # print(int(i.strip()))
    
    # li = [11,22,33,44,55,77,88,99,90]
    # result = {'key1':[],'key2':[]}
    # for row in li:
    # li = [11,22,33,44,55,77,88,99,90]
    # result = {}
    # for row in li:
    #     if row > 66:
    #         if 'key1' not in result:
    #             result['key1']=[]
    #         result['key1'].append(row)
    #     else:
    #         if 'key2' not in result:
    #             result['key2']=[]  # result = {'key2':[]}
    #         result['key2'].append(row)
    # print(result)
    
    # li = [11,22,33,44,55,77,88,99,90]
    # result = {}
    # for row in li:
    #     result.setdefault('key1',[])
    #     result.setdefault('key2',[])
    #     if row > 66:
    #         result['key1'].append(row)
    #     else:
    #         result['key2'].append(row)
    
    

  • 相关阅读:
    Promise
    ajax基础
    flex布局的盒子模型
    css3核心模块
    响应式开发
    HTML5标签及表单
    JS面向对象编程
    JS面向对象的编程
    ES5构造函数与ES6类
    类欧几里得算法
  • 原文地址:https://www.cnblogs.com/xibanqiu/p/12314097.html
Copyright © 2020-2023  润新知