Skip to content

Instantly share code, notes, and snippets.

@ssskip
Last active January 7, 2016 04:19
Show Gist options
  • Save ssskip/0a03f913f20df8630a3c to your computer and use it in GitHub Desktop.
Save ssskip/0a03f913f20df8630a3c to your computer and use it in GitHub Desktop.
interview

#Basic

  • Explain the dictionary in Python(简单介绍下 python 里的字典).
  • How do we share global variables across modules in Python? (怎么在不同模块里共享一个全局变量?)
  • How do I convert a string to a number? (怎么把一个字符串转为数字型?)
  • how to read a 8GB file in python? (你会用什么样的方式读取一个8G文件?)
  • Do you know the difference between range and xrange? (range 和 xrange 的区别?)
  • os.path.dirname() & os.path.basename() (这两个方法的区别?)
  • Making a list with unique element from a list with duplicate elements (怎么给一个可能有重复元素的数组去重?)
  • mutable vs immutable (简单阐述 可变 和 不可变)
  • What's the fastest way to swap the values bound to two variables? (你有哪些方式交换两个变量的值?)
  • Do functions (or methods) return something even if there isn't a return statement? If so, what do they return?(如果一个函数没有 return 语句 调用之后会有返回值吗?)
  • How do you reverse a list? Can you come up with at least three ways? (列举几种方法倒转一个数组?)
  • How can you return multiple values from a function/method? (你如何在函数里返回多个值?)
  • Difference between remove, del and pop on lists (List 的 remove、del、pop 方法的作用?)
  • Describe how to generate random numbers in Python. (怎么随机生成数字?)
  • What does if __name__ == “__main__”: do?
  • Sort a Python dictionary by value (如何按照值排序一个字典?)
  • What's the difference between the list methods append() and extend()? (list 的 append 和 extend 的区别?)
  • How do I randomly select an item from a list using Python? (怎么从一个数组里随机取一个元素?)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment