Python Coding Interview
Python Coding Interview
Python Advanced
Use enumerate() to iterate over both indices and values
Debug problematic code with breakpoint()
Format strings effectively with f-strings
Sort lists with custom arguments
Use generators instead of list comprehensions to conserve memory
Define default values when looking up dictionary keys
Count hashable objects with the collections.Counter class
Use the standard library to get lists of permutations and combinations
enumerate()
enumerate() is a built-in function to iterate through a sequence and keep track of both the index and the number.
>>> list(range(11))
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>> list(enumerate([1, 2, 3]))
[(0, 1), (1, 2), (2, 3)]
>>> list(enumerate([1, 2, 3], start=10))
[(10, 1), (11, 2), (12, 3)]
list = [45, 22, 14, 65, 97, 72].
for i, num in enumerate(numbers):
if num % 3 == 0:
numbers[i] = "fizz"
if num % 5 == 0:
numbers[i] = "buzz"
if num % 5 == 0 and num % 3 == 0:
numbers[i] = "fizzbuzz"
for i, num in enumerate(numbers):
if num % 5 == 0 and num % 3 == 0:
numbers[i] = "fizzbuzz"
elif num % 3 == 0:
numbers[i] = "fizz"
elif num % 5 == 0:
numbers[i] = "buzz"
Jupyter
Jupyter Notebook Interface
https://ipython.org/index.html
Jupyter Notebook
https://jupyter.readthedocs.io/en/latest/install.html
refs
https://realpython.com/lessons/python-coding-interview-tips-overview/
https://realpython.com/courses/python-range-function/
https://realpython.com/lessons/use-enumerate-keep-running-index/
xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
Python Coding Interview的更多相关文章
- Cracking the coding interview目录及资料收集
前言 <Cracking the coding interview>是一本被许多人极力推荐的程序员面试书籍, 详情可见:http://www.careercup.com/book. 第六版 ...
- Cracking the coding interview
写在开头 最近忙于论文的开题等工作,还有阿里的实习笔试,被虐的还行,说还行是因为自己的水平或者说是自己准备的还没有达到他们所需要人才的水平,所以就想找一本面试的书<Cracking the co ...
- 转:Top 10 Algorithms for Coding Interview
The following are top 10 algorithms related concepts in coding interview. I will try to illustrate t ...
- Cracking the coding interview 第一章问题及解答
Cracking the coding interview 第一章问题及解答 不管是不是要挪地方,面试题具有很好的联系代码总用,参加新工作的半年里,做的大多是探索性的工作,反而代码写得少了,不高兴,最 ...
- Cracking the Coding Interview(Trees and Graphs)
Cracking the Coding Interview(Trees and Graphs) 树和图的训练平时相对很少,还是要加强训练一些树和图的基础算法.自己对树节点的设计应该不是很合理,多多少少 ...
- Cracking the Coding Interview(Stacks and Queues)
Cracking the Coding Interview(Stacks and Queues) 1.Describe how you could use a single array to impl ...
- crack the coding interview
crack the coding interview answer c++ 1.1 #ifndef __Question_1_1_h__ #define __Question_1_1_h__ #i ...
- 《Cracking the Coding Interview》读书笔记
<Cracking the Coding Interview>是适合硅谷技术面试的一本面试指南,因为题目分类清晰,风格比较靠谱,所以广受推崇. 以下是我的读书笔记,基本都是每章的课后习题解 ...
- python coding style guide 的高速落地实践
python coding style guide 的高速落地实践 机器和人各有所长,如coding style检查这样的可自己主动化的工作理应交给机器去完毕,故发此文帮助你在几分钟内实现coding ...
随机推荐
- Java并发包源码学习系列:阻塞队列实现之PriorityBlockingQueue源码解析
目录 PriorityBlockingQueue概述 类图结构及重要字段 什么是二叉堆 堆的基本操作 向上调整void up(int u) 向下调整void down(int u) 构造器 扩容方法t ...
- 详解Mybatisplus
详解Mybatisplus MyBatis-Plus(简称 MP)是一个 MyBatis的增强工具,在 MyBatis 的基础上只做增强不做改变,为简化开发.提高效率而生. 特性: 无侵入**:只 ...
- 有状态(Stateful)应用的容器化 - 云+社区 - 腾讯云 https://cloud.tencent.com/developer/article/1020178
有状态(Stateful)应用的容器化 - 云+社区 - 腾讯云 https://cloud.tencent.com/developer/article/1020178
- 在IDEA中用三个jar包链接MongoDB数据库——实现增删改查
安装Robo 3T连接MongoDB数据库教程:https://blog.csdn.net/baidu_39298625/article/details/98845789 使用Robo 3T操作Mon ...
- Prometheus为你的SpringBoot应用保驾护航
前面我们介绍了Prometheus的作用和整体的架构,相信大家对Prometheus有了一定的了解. 具体可以查看这篇文章:https://mp.weixin.qq.com/s/QoAs0-AYy8k ...
- Kepware软件基本操作及使用Java Utgard实现OPC通信
一.环境搭建(基于win10 64位专业版) 1.Kepware 的下载.安装及使用 https://www.cnblogs.com/ioufev/p/9366877.html 2.重要:OPC 和 ...
- Grafana+Prometheus通过node_exporter监控Linux服务器信息
Grafana+Prometheus通过node_exporter监控Linux服务器信息 一.Grafana+Prometheus通过node_exporter监控Linux服务器信息 1.1nod ...
- JDBC连接Oracle实现增、删、改操作
jsp页面的form表单 AddMentaction实现向数据新增数据操作 DeleteMent删除操作 UpdateMent修改操作 最近在做一个练习项目"在线考试系统",在将整 ...
- 37.Samba 文件共享服务1--配置共享资源
1.Samba 服务程序的主配置文件包括全局配置参数和区域配置参数.全局配置参数用于设置整体的资源共享环境,对里面的每一个独立的共享资源都有效.区域配置参数则用于设置单独的共享资源,且仅对该资源有效. ...
- 【BFS】hdu 1973 Prime Path
题目描述: http://poj.org/problem?id=3414 中文大意: 使用两个锅,盛取定量水. 两个锅的容量和目标水量由用户输入. 允许的操作有:灌满锅.倒光锅内的水.一个锅中的水倒入 ...