加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

高德公司的Python面试题!不比大厂的易啊!小白快学学!

发布时间:2020-12-17 01:21:32 所属栏目:Python 来源:网络整理
导读:p style="margin-top:16px;color:rgb(34,34,34);font-family:'PingFang SC','Hiragino Sans GB','Microsoft YaHei','WenQuanYi Micro Hei','Helvetica Neue',Arial,sans-serif;line-height:28px;background-color:rgb(255,255,255);" p style="margin-top:16

<p style="margin-top:16px;color:rgb(34,34,34);font-family:'PingFang SC','Hiragino Sans GB','Microsoft YaHei','WenQuanYi Micro Hei','Helvetica Neue',Arial,sans-serif;line-height:28px;background-color:rgb(255,255,255);">

高德公司的Python面试题!不比大厂的易啊!小白快学学!

<p style="margin-top:16px;color:rgb(34,255);">

高德公司的Python面试题!不比大厂的易啊!小白快学学!

<p style="margin-top:16px;color:rgb(34,255);"><span style="font-weight:700;">2. 静态函数,类函数,成员函数、属性函数的区别?

<p style="margin-top:16px;color:rgb(34,255);">

高德公司的Python面试题!不比大厂的易啊!小白快学学!

<p style="margin-top:16px;color:rgb(34,255);">

高德公司的Python面试题!不比大厂的易啊!小白快学学!

<p style="margin-top:16px;color:rgb(34,255);">

高德公司的Python面试题!不比大厂的易啊!小白快学学!

<p style="margin-top:16px;color:rgb(34,255);">2.2 类方法举例:

<p style="margin-top:16px;color:rgb(34,255);">

高德公司的Python面试题!不比大厂的易啊!小白快学学!

<p style="margin-top:16px;color:rgb(34,255);">2.3 属性方法举例:

<p style="margin-top:16px;color:rgb(34,255);">

高德公司的Python面试题!不比大厂的易啊!小白快学学!

<p style="margin-top:16px;color:rgb(34,255);"><span style="font-weight:700;">3. a=1,b=2,不用中间变量交换a和b的值

<p style="margin-top:16px;color:rgb(34,255);"><span style="font-weight:700;">解答: 三种形式: 直接交换、加法或异或

<p style="margin-top:16px;color:rgb(34,255);">示例:

<p style="margin-top:16px;color:rgb(34,255);">

高德公司的Python面试题!不比大厂的易啊!小白快学学!

<p style="margin-top:16px;color:rgb(34,255);"><span style="font-weight:700;">4. 写一个函数,输入一个字符串,返回倒序排列的结果: 如: string_reverse(‘abcdef’),返回: ‘fedcba’<span style="font-weight:700;">(请采用多种方法实现,并对实现方法进行比较)

<p style="margin-top:16px;color:rgb(34,255);">解决方法:先转成列表,反转列表后,再转成字符串。

<p style="margin-top:16px;color:rgb(34,255);">

高德公司的Python面试题!不比大厂的易啊!小白快学学!

<p style="margin-top:16px;color:rgb(34,255);"><span style="font-weight:700;">5. 请用自己的算法,按升序合并如下两个list,并去除重复的元素:

<p style="margin-top:16px;color:rgb(34,255);"><span style="font-weight:700;">list1 = [2,3,8,4,9,5,6]

<p style="margin-top:16px;color:rgb(34,255);"><span style="font-weight:700;">list2 = [5,6,10,17,11,2]

<p style="margin-top:16px;color:rgb(34,255);">解答:先转换成集合自动去重,再转换成列表。

<p style="margin-top:16px;color:rgb(34,255);">

高德公司的Python面试题!不比大厂的易啊!小白快学学!

<p style="margin-top:16px;color:rgb(34,255);"><span style="font-weight:700;">6. 请写出打印结果:

<p style="margin-top:16px;color:rgb(34,255);"><span style="font-weight:700;">x = [0,1]

<p style="margin-top:16px;color:rgb(34,255);"><span style="font-weight:700;">i = 0

<p style="margin-top:16px;color:rgb(34,255);"><span style="font-weight:700;">i,x[i] = 1,2

<p style="margin-top:16px;color:rgb(34,255);"><span style="font-weight:700;">print(x)

<p style="margin-top:16px;color:rgb(34,255);"><span style="font-weight:700;">打印结果:?[0,2],python可以使用连续赋值,从左至右.

<p style="margin-top:16px;color:rgb(34,255);"><span style="font-weight:700;">g = lambda x,y=2,z : x + y**z

<p style="margin-top:16px;color:rgb(34,255);"><span style="font-weight:700;">g(1,z=10) = ?

<p style="margin-top:16px;color:rgb(34,255);"><span style="font-weight:700;">打印结果:?异常,形参表末尾才可以有默认参数,z需要提供默认参数.

<p style="margin-top:16px;color:rgb(34,255);"><span style="font-weight:700;">7. 说一下以下代码片段存在的问题

<p style="margin-top:16px;color:rgb(34,255);">

高德公司的Python面试题!不比大厂的易啊!小白快学学!

<p style="margin-top:16px;color:rgb(34,255);">解答:

<p style="margin-top:16px;color:rgb(34,255);">1、警告:object 是python中保留的关键字,不应被重新定义。

<p style="margin-top:16px;color:rgb(34,255);">2、类方法是类所拥有的方法,传入的参数应为cls,而不是self。

<p style="margin-top:16px;color:rgb(34,255);">3、错误:Python实例化对象不需要new关键字。

<p style="margin-top:16px;color:rgb(34,255);">4、错误:@property,表示属性,不是方法,则不需要加括号”()”,直接调用object.man,即可。

<p style="margin-top:16px;color:rgb(34,255);">5、错误: 如果想重写基类的构造方法,则需要继承基类的构造方法再重写。

<p style="margin-top:16px;color:rgb(34,255);">6、额外:类名尽量大写。

<p style="margin-top:16px;color:rgb(34,255);">

高德公司的Python面试题!不比大厂的易啊!小白快学学!

<p style="margin-top:16px;color:rgb(34,255);">

高德公司的Python面试题!不比大厂的易啊!小白快学学!

<p style="margin-top:16px;color:rgb(34,255);">

高德公司的Python面试题!不比大厂的易啊!小白快学学!

<p style="margin-top:16px;color:rgb(34,255);"><span style="font-weight:700;">开发体会:

<p style="margin-top:16px;color:rgb(34,255);">异常主要处理读取文件,也可以使用with的方法读取文件; 还可以用于网络连接,异常可以包含大量的错误信息,进行错误处理.

<p style="margin-top:16px;color:rgb(34,255);">希望大家都能找到自己想找的工作!

<p style="margin-top:16px;color:rgb(34,255);">

高德公司的Python面试题!不比大厂的易啊!小白快学学!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读