Python 練習(xí)實(shí)例42 Python 100例 題目:學(xué)習(xí)使用auto定義變量的用法。 程序分析:沒有auto關(guān)鍵字,使用變量作用域來舉例吧。 程序源代碼: #!/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 練習(xí)實(shí)例52 Python 100例 題目:學(xué)習(xí)使用按位或 | 。 程序分析: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 練習(xí)實(shí)例62 Python 100例 題目:查找字符串?! ?程序分析:無。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- sStr1 = 'abcdefg' sStr2 = 'cde' print sStr1.find(sStr2) 以上實(shí)例輸出結(jié)果為: 2 Python 100例
http://m.o2fo.com/python/python-exercise-example62.htmlPython 練習(xí)實(shí)例53 Python 100例 題目:學(xué)習(xí)使用按位異或 ^ 。 程序分析: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 練習(xí)實(shí)例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 練習(xí)實(shí)例44 Python 100例 題目:學(xué)習(xí)使用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 練習(xí)實(shí)例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 練習(xí)實(shí)例45 Python 100例 題目:統(tǒng)計(jì) 1 到 100 之和。 程序分析:無 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- tmp = 0 for i in range(1,101): tmp += i print 'The sum is %d' % tmp 以上實(shí)例輸出結(jié)果為: The sum is 5050 Python 100例
http://m.o2fo.com/python/python-exercise-example45.htmlPython 練習(xí)實(shí)例65 Python 100例 題目:一個(gè)最優(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.htmlPython 練習(xí)實(shí)例46 Python 100例 題目:求輸入數(shù)字的平方,如果平方運(yùn)算后小于 50 則退出。 程序分析:無 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- TRUE = 1 FALSE = 0 def SQ(x): return x * x print '如果輸入的數(shù)字小于 50,程序?qū)⑼V?..
http://m.o2fo.com/python/python-exercise-example46.html抱歉,暫時(shí)沒有相關(guān)的微課
w3cschool 建議您:
抱歉,暫時(shí)沒有相關(guān)的視頻課程
w3cschool 建議您:
抱歉,暫時(shí)沒有相關(guān)的教程
w3cschool 建議您:
Python 練習(xí)實(shí)例42 Python 100例 題目:學(xué)習(xí)使用auto定義變量的用法。 程序分析:沒有auto關(guān)鍵字,使用變量作用域來舉例吧。 程序源代碼: #!/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 練習(xí)實(shí)例52 Python 100例 題目:學(xué)習(xí)使用按位或 | 。 程序分析: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 練習(xí)實(shí)例62 Python 100例 題目:查找字符串。 程序分析:無。 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- sStr1 = 'abcdefg' sStr2 = 'cde' print sStr1.find(sStr2) 以上實(shí)例輸出結(jié)果為: 2 Python 100例
http://m.o2fo.com/python/python-exercise-example62.htmlPython 練習(xí)實(shí)例53 Python 100例 題目:學(xué)習(xí)使用按位異或 ^ 。 程序分析: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 練習(xí)實(shí)例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 練習(xí)實(shí)例44 Python 100例 題目:學(xué)習(xí)使用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 練習(xí)實(shí)例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 練習(xí)實(shí)例45 Python 100例 題目:統(tǒng)計(jì) 1 到 100 之和。 程序分析:無 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- tmp = 0 for i in range(1,101): tmp += i print 'The sum is %d' % tmp 以上實(shí)例輸出結(jié)果為: The sum is 5050 Python 100例
http://m.o2fo.com/python/python-exercise-example45.htmlPython 練習(xí)實(shí)例65 Python 100例 題目:一個(gè)最優(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.htmlPython 練習(xí)實(shí)例46 Python 100例 題目:求輸入數(shù)字的平方,如果平方運(yùn)算后小于 50 則退出。 程序分析:無 程序源代碼: #!/usr/bin/python # -*- coding: UTF-8 -*- TRUE = 1 FALSE = 0 def SQ(x): return x * x print '如果輸入的數(shù)字小于 50,程序?qū)⑼V?..
http://m.o2fo.com/python/python-exercise-example46.html抱歉,暫時(shí)沒有相關(guān)的文章
w3cschool 建議您: