Python 練習實例61 Python 100例 題目:打印出楊輝三角形(要求打印出10行如下圖)。 程序分析:無。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == '__main__': a = [] for i in range(10): a.append([]) for j in range(10): a[i].ap...
http://m.o2fo.com/python/python-exercise-example61.htmlPython 練習實例42 Python 100例 題目:學習使用auto定義變量的用法。 程序分析:沒有auto關鍵字,使用變量作用域來舉例吧。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- num = 2 def autofunc(): num = 1 print 'internal block num = %d' % num ...
http://m.o2fo.com/python/python-exercise-example42.htmlPython 練習實例52 Python 100例 題目:學習使用按位或 | 。 程序分析:0|0=0; 0|1=1; 1|0=1; 1|1=1 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == '__main__': a = 077 b = a | 3 print 'a | b is %d' % b b |= 7 print 'a | b is %d' % b...
http://m.o2fo.com/python/python-exercise-example52.htmlPython 練習實例62 Python 100例 題目:查找字符串?! ?程序分析:無。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- sStr1 = 'abcdefg' sStr2 = 'cde' print sStr1.find(sStr2) 以上實例輸出結果為: 2 Python 100例
http://m.o2fo.com/python/python-exercise-example62.htmlPython 練習實例53 Python 100例 題目:學習使用按位異或 ^ 。 程序分析:0^0=0; 0^1=1; 1^0=1; 1^1=0 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == '__main__': a = 077 b = a ^ 3 print 'The a ^ 3 = %d' % b b ^= 7 print 'The a ^ b = %d...
http://m.o2fo.com/python/python-exercise-example53.htmlPython 練習實例63 Python 100例 題目:畫橢圓ellipse。 程序分析:無。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == '__main__': from Tkinter import * x = 360 y = 160 top = y - 30 bottom = y - 30 canvas = Canvas(width = 400,height = 600,bg = ...
http://m.o2fo.com/python/python-exercise-example63.htmlPython 練習實例44 Python 100例 題目:學習使用external的用法。。 程序分析:無 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- import external if __name__ == '__main__': print external.add(10,20) Python 100例
http://m.o2fo.com/python/python-exercise-example44.htmlPython 練習實例64 Python 100例 題目:利用ellipse 和 rectangle 畫圖。?!?程序分析:無。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == '__main__': from Tkinter import * canvas = Canvas(width = 400,height = 600,bg = 'white') left = ...
http://m.o2fo.com/python/python-exercise-example64.htmlPython 練習實例45 Python 100例 題目:統(tǒng)計 1 到 100 之和。 程序分析:無 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- tmp = 0 for i in range(1,101): tmp += i print 'The sum is %d' % tmp 以上實例輸出結果為: The sum is 5050 Python 100例
http://m.o2fo.com/python/python-exercise-example45.htmlPython 練習實例65 Python 100例 題目:一個最優(yōu)美的圖案?! ?程序分析:無。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- import math class PTS: def __init__(self): self.x = 0 self.y = 0 points = [] def LineToDemo(): from Tkinter import * screenx = 400 screen...
http://m.o2fo.com/python/python-exercise-example65.html抱歉,暫時沒有相關的微課
w3cschool 建議您:
抱歉,暫時沒有相關的視頻課程
w3cschool 建議您:
抱歉,暫時沒有相關的教程
w3cschool 建議您:
Python 練習實例61 Python 100例 題目:打印出楊輝三角形(要求打印出10行如下圖)?! ?程序分析:無。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == '__main__': a = [] for i in range(10): a.append([]) for j in range(10): a[i].ap...
http://m.o2fo.com/python/python-exercise-example61.htmlPython 練習實例42 Python 100例 題目:學習使用auto定義變量的用法。 程序分析:沒有auto關鍵字,使用變量作用域來舉例吧。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- num = 2 def autofunc(): num = 1 print 'internal block num = %d' % num ...
http://m.o2fo.com/python/python-exercise-example42.htmlPython 練習實例52 Python 100例 題目:學習使用按位或 | 。 程序分析:0|0=0; 0|1=1; 1|0=1; 1|1=1 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == '__main__': a = 077 b = a | 3 print 'a | b is %d' % b b |= 7 print 'a | b is %d' % b...
http://m.o2fo.com/python/python-exercise-example52.htmlPython 練習實例62 Python 100例 題目:查找字符串?! ?程序分析:無。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- sStr1 = 'abcdefg' sStr2 = 'cde' print sStr1.find(sStr2) 以上實例輸出結果為: 2 Python 100例
http://m.o2fo.com/python/python-exercise-example62.htmlPython 練習實例53 Python 100例 題目:學習使用按位異或 ^ 。 程序分析:0^0=0; 0^1=1; 1^0=1; 1^1=0 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == '__main__': a = 077 b = a ^ 3 print 'The a ^ 3 = %d' % b b ^= 7 print 'The a ^ b = %d...
http://m.o2fo.com/python/python-exercise-example53.htmlPython 練習實例63 Python 100例 題目:畫橢圓ellipse?!?程序分析:無。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == '__main__': from Tkinter import * x = 360 y = 160 top = y - 30 bottom = y - 30 canvas = Canvas(width = 400,height = 600,bg = ...
http://m.o2fo.com/python/python-exercise-example63.htmlPython 練習實例44 Python 100例 題目:學習使用external的用法。。 程序分析:無 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- import external if __name__ == '__main__': print external.add(10,20) Python 100例
http://m.o2fo.com/python/python-exercise-example44.htmlPython 練習實例64 Python 100例 題目:利用ellipse 和 rectangle 畫圖。。 程序分析:無。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == '__main__': from Tkinter import * canvas = Canvas(width = 400,height = 600,bg = 'white') left = ...
http://m.o2fo.com/python/python-exercise-example64.htmlPython 練習實例45 Python 100例 題目:統(tǒng)計 1 到 100 之和。 程序分析:無 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- tmp = 0 for i in range(1,101): tmp += i print 'The sum is %d' % tmp 以上實例輸出結果為: The sum is 5050 Python 100例
http://m.o2fo.com/python/python-exercise-example45.htmlPython 練習實例65 Python 100例 題目:一個最優(yōu)美的圖案?! ?程序分析:無。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- import math class PTS: def __init__(self): self.x = 0 self.y = 0 points = [] def LineToDemo(): from Tkinter import * screenx = 400 screen...
http://m.o2fo.com/python/python-exercise-example65.html抱歉,暫時沒有相關的文章
w3cschool 建議您: