初学python心得

首次接触编程语言C语言之后学了c++,觉得c++好用的呀批,然而指针让我这个逻辑思维需要很好锻炼的人很头大。学了JAVA之后感觉这个玩意儿又好用的呀批,掌握了面向对象的编程原则后,编程变得有趣了起来,虽然java也只学了java se,听说安卓领域已经挤得要命了,所以就避其锋芒准备在ee上下功夫,突然间~听说大数据火的呀批。赶紧去看了python,一开始买了《深入浅出python》这本书(话说这个系列的书是真的适合入门,鄙人性子急,不喜欢长时间的看字去学习,而这本书就像是漫画,易于理解,语言通俗易懂),然而停在了书的共享部分的教学,转手去看小甲鱼的零基础入门学习python,如果你和我一样不喜欢看那种古板的东西,那小甲鱼的视频你绝对要去看,当然,如果你要学python。而编程方面,python给我的感觉就是,它是你逻辑上思维的更直接的体现,如果有相关的编程经验,python真的是一门很容易入手的语言

比如:

# -*- coding: UTF-8 -*-
list1 = [1, 3, 4, 3, 5, 7, 7, 6, 2]
list2 = [7, 5, 4, 86, 1, 3, 4]
#function1: to give out the biggets item of the two list and print the coordinate :
biggest_item1=[]
biggest_item2=[]
for biggest_item in list1:
    if biggest_item ==max(list1):
        biggest_item1.append(list1.index(biggest_item))
print('the biggest of the list1 is:'+str(max(list1))+' the coordinates are :'+str(biggest_item1))
for biggest_item in list2:
    if biggest_item ==max(list2):
        biggest_item2.append(list2.index(biggest_item))
print('the biggest of the list1 is:'+str(max(list2))+' the coordinates are :'+str(biggest_item2))
#function2: to give out the same items in two lists:
list_same=[]
for item1 in list1:
    for item2 in list2:
        if(item1==item2):
            list_same.append(item1)
if len(list_same)==0:
    print('there is no same item in the two lists,bro')
else:
    print('the same items are:')
    print(list_same)

我的第一门作业,写的就是很简单的拿两个列表去取最大值、最大值的位置、并取出相同元素。就这样很简单的实现了,什么定义变量的都见鬼去吧~~

嘛~运行结果就如上啦~,虽然说是一个很简单的程序,但也能感受到python编程的奇妙之处,心走到哪里,代码就敲到哪里~。

总之就是这样先,今后慢慢积累学习感悟

ps:新手写bolg,高手勿喷,有想学的小伙伴一起努力吧!

你可能感兴趣的:(学习感悟)