初識python

Python 主頁

    Python主頁(https://www.python.org/)上有許多關於Python的資源,主頁上有Python的下載,Python的幫助文檔,社區,成功案例,以及新聞。作爲初學者,我們應多瀏覽Python主頁,獲取更多Python的知識。    

    Python主頁上的getting started 板塊主要爲初學者提供幫助。這個板塊裏面給出了許多官方的幫組文檔。

    Download板塊上主要提供的是python在不同平臺上的不同版本的安裝程序。我現在使用的是python 3.6.4 for windows。

    Documentation提供了官方的說明文檔,我想我們以後會經常用到python的說明文檔

    Community上有Python的論壇,我們可以在上面提出有關Python的問題,並與他人分享自己對Python的見解。

    總而言之,在學習python的過程中,我們應多瀏覽python主頁

用Python實現什麼樣的程序

    現在我對python這門還不怎麼熟悉,所以不知日後能把Python運用到什麼程度,若成爲Python編程高手,我想我會寫寫有關機器學習的東西還有利用python進行網頁設計吧。

課後作業

2-1

a='Hello World!'
print(a)

2-2

a='Hello World!'
print(a)
a='Hello SYSU'
print(a)

2-3

a='Zheng Zhenhang'
print('Hello '+a+', would you like to learn some Python today?')

2-4

a='zhenhang zheng'
print(a.lower())
print(a.upper())
print(a.title())

2-5

info='Napoleon Bonaparte once said, "Every French soldier carries a marshal\'s baton in his knapsack."'
print(info)

2-6

name='Napoleon Bonaparte'
message=name+' once said, "Every French soldier carries a marshal\'s baton in his knapsack."'
print(message)

2-7

name='\tNapoleon Bonaparte\t'
name
name.lstrip()
name.rstrip()
name.strip()

2-8

print(2+6)
print(11-3)
print(2*4)
print(56//7)

2-9

info=233
info='My favorite number is '+str(info)
print(info)

2-10

#Date:2018/03/11
print(2+6)
print(11-3)
print(2*4)
print(56//7)

2-11

import this

2-11的輸出

The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章