App下載

詞條

大約有 800 項(xiàng)符合查詢(xún)結(jié)果 ,庫(kù)內(nèi)數(shù)據(jù)總量為 78,250 項(xiàng)。(搜索耗時(shí):0.0026秒)

181.Python 練習(xí)實(shí)例32

Python 練習(xí)實(shí)例32 Python 100例 題目:按相反的順序輸出列表的值。 程序分析:無(wú)。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- a = ['one', 'two', 'three'] for i in a[::-1]: print i 以上實(shí)例輸出結(jié)果為: three two one Python 1...

http://www.o2fo.com/python/python-exercise-example32.html

182.Python 練習(xí)實(shí)例23

Python 練習(xí)實(shí)例23 Python 100例 題目:打印出如下圖案(菱形): * *** ***** ******* ***** *** * 程序分析:先把圖形分成兩部分來(lái)看待,前四行一個(gè)規(guī)律,后三行一個(gè)規(guī)律,利用雙重for循環(huán),第一層控制行,第二層控制列。 程序源代碼:...

http://www.o2fo.com/python/python-exercise-example23.html

183.Python 練習(xí)實(shí)例33

Python 練習(xí)實(shí)例33 Python 100例 題目:按逗號(hào)分隔列表。 程序分析:無(wú)。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- L = [1,2,3,4,5] s1 = ','.join(str(n) for n in L) print s1 以上實(shí)例輸出結(jié)果為: 1,2,3,4,5 Python 100例

http://www.o2fo.com/python/python-exercise-example33.html

184.Python 練習(xí)實(shí)例34

Python 練習(xí)實(shí)例34 Python 100例 題目:練習(xí)函數(shù)調(diào)用。 程序分析:無(wú)。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- def hello_world(): print 'hello world' def three_hellos(): for i in range(3): hello_world() if __name__ == '__main__': three_hellos()...

http://www.o2fo.com/python/python-exercise-example34.html

185.Python 練習(xí)實(shí)例35

Python 練習(xí)實(shí)例35 Python 100例 題目:文本顏色設(shè)置。 程序分析:無(wú)。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m...

http://www.o2fo.com/python/python-exercise-example35.html

186.Python 練習(xí)實(shí)例26

Python 練習(xí)實(shí)例26 Python 100例 題目:利用遞歸方法求5!。 程序分析:遞歸公式:fn=fn_1*4! 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- def fact(j): sum = 0 if j == 0: sum = 1 else: sum = j * fact(j - 1) return sum for i in range(5): print '%d! = %d' %...

http://www.o2fo.com/python/python-exercise-example26.html

187.Python 練習(xí)實(shí)例36

Python 練習(xí)實(shí)例36 Python 100例 題目:求100之內(nèi)的素?cái)?shù)。 程序分析:無(wú)。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- from math import sqrt if __name__ == '__main__': N = 100 a = range(0,N) for i in range(2,int(sqrt(N))): for j in range(i + 1,N): if (a[i] ...

http://www.o2fo.com/python/python-exercise-example36.html

188.Python 練習(xí)實(shí)例27

Python 練習(xí)實(shí)例27 Python 100例 題目:利用遞歸函數(shù)調(diào)用方式,將所輸入的5個(gè)字符,以相反順序打印出來(lái)。 程序分析:無(wú)。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- def output(s,l): if l==0: return print (s[l-1]) output(s,l-1) s = raw_input(...

http://www.o2fo.com/python/python-exercise-example27.html

189.Python 練習(xí)實(shí)例37

Python 練習(xí)實(shí)例37 Python 100例 題目:對(duì)10個(gè)數(shù)進(jìn)行排序。 程序分析:可以利用選擇法,即從后9個(gè)比較過(guò)程中,選擇一個(gè)最小的與第一個(gè)元素交換,下次類(lèi)推,即用第二個(gè)元素與后8個(gè)進(jìn)行比較,并進(jìn)行交換。 程序源代碼: #!/usr/bin...

http://www.o2fo.com/python/python-exercise-example37.html

190.Python 練習(xí)實(shí)例38

Python 練習(xí)實(shí)例38 Python 100例 題目:求一個(gè)3*3矩陣對(duì)角線(xiàn)元素之和。 程序分析:利用雙重for循環(huán)控制輸入二維數(shù)組,再將a[i][i]累加后輸出。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == '__main__': a = [] sum = 0.0 for...

http://www.o2fo.com/python/python-exercise-example38.html

抱歉,暫時(shí)沒(méi)有相關(guān)的微課

w3cschool 建議您:

  • 檢查輸入的文字是否有誤

抱歉,暫時(shí)沒(méi)有相關(guān)的視頻課程

w3cschool 建議您:

  • 檢查輸入的文字是否有誤

抱歉,暫時(shí)沒(méi)有相關(guān)的教程

w3cschool 建議您:

  • 檢查輸入的文字是否有誤

181.Python 練習(xí)實(shí)例32

Python 練習(xí)實(shí)例32 Python 100例 題目:按相反的順序輸出列表的值。 程序分析:無(wú)。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- a = ['one', 'two', 'three'] for i in a[::-1]: print i 以上實(shí)例輸出結(jié)果為: three two one Python 1...

http://www.o2fo.com/python/python-exercise-example32.html

182.Python 練習(xí)實(shí)例23

Python 練習(xí)實(shí)例23 Python 100例 題目:打印出如下圖案(菱形): * *** ***** ******* ***** *** * 程序分析:先把圖形分成兩部分來(lái)看待,前四行一個(gè)規(guī)律,后三行一個(gè)規(guī)律,利用雙重for循環(huán),第一層控制行,第二層控制列。 程序源代碼:...

http://www.o2fo.com/python/python-exercise-example23.html

183.Python 練習(xí)實(shí)例33

Python 練習(xí)實(shí)例33 Python 100例 題目:按逗號(hào)分隔列表。 程序分析:無(wú)。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- L = [1,2,3,4,5] s1 = ','.join(str(n) for n in L) print s1 以上實(shí)例輸出結(jié)果為: 1,2,3,4,5 Python 100例

http://www.o2fo.com/python/python-exercise-example33.html

184.Python 練習(xí)實(shí)例34

Python 練習(xí)實(shí)例34 Python 100例 題目:練習(xí)函數(shù)調(diào)用。 程序分析:無(wú)。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- def hello_world(): print 'hello world' def three_hellos(): for i in range(3): hello_world() if __name__ == '__main__': three_hellos()...

http://www.o2fo.com/python/python-exercise-example34.html

185.Python 練習(xí)實(shí)例35

Python 練習(xí)實(shí)例35 Python 100例 題目:文本顏色設(shè)置。 程序分析:無(wú)。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m...

http://www.o2fo.com/python/python-exercise-example35.html

186.Python 練習(xí)實(shí)例26

Python 練習(xí)實(shí)例26 Python 100例 題目:利用遞歸方法求5!。 程序分析:遞歸公式:fn=fn_1*4! 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- def fact(j): sum = 0 if j == 0: sum = 1 else: sum = j * fact(j - 1) return sum for i in range(5): print '%d! = %d' %...

http://www.o2fo.com/python/python-exercise-example26.html

187.Python 練習(xí)實(shí)例36

Python 練習(xí)實(shí)例36 Python 100例 題目:求100之內(nèi)的素?cái)?shù)。 程序分析:無(wú)。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- from math import sqrt if __name__ == '__main__': N = 100 a = range(0,N) for i in range(2,int(sqrt(N))): for j in range(i + 1,N): if (a[i] ...

http://www.o2fo.com/python/python-exercise-example36.html

188.Python 練習(xí)實(shí)例27

Python 練習(xí)實(shí)例27 Python 100例 題目:利用遞歸函數(shù)調(diào)用方式,將所輸入的5個(gè)字符,以相反順序打印出來(lái)。 程序分析:無(wú)。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- def output(s,l): if l==0: return print (s[l-1]) output(s,l-1) s = raw_input(...

http://www.o2fo.com/python/python-exercise-example27.html

189.Python 練習(xí)實(shí)例37

Python 練習(xí)實(shí)例37 Python 100例 題目:對(duì)10個(gè)數(shù)進(jìn)行排序。 程序分析:可以利用選擇法,即從后9個(gè)比較過(guò)程中,選擇一個(gè)最小的與第一個(gè)元素交換,下次類(lèi)推,即用第二個(gè)元素與后8個(gè)進(jìn)行比較,并進(jìn)行交換。 程序源代碼: #!/usr/bin...

http://www.o2fo.com/python/python-exercise-example37.html

190.Python 練習(xí)實(shí)例38

Python 練習(xí)實(shí)例38 Python 100例 題目:求一個(gè)3*3矩陣對(duì)角線(xiàn)元素之和。 程序分析:利用雙重for循環(huán)控制輸入二維數(shù)組,再將a[i][i]累加后輸出。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == '__main__': a = [] sum = 0.0 for...

http://www.o2fo.com/python/python-exercise-example38.html

抱歉,暫時(shí)沒(méi)有相關(guān)的文章

w3cschool 建議您:

  • 檢查輸入的文字是否有誤

熱門(mén)課程