import randomsecret=random.randint(1,100) #從1~100中產生一個隨機數guess=0tries=0print"Hi peng ! I'm shanshan, and I have a secret!"print "It is a number from 1 to 99.I'll give you 6 tries."while guess!=secret and tries<6: guess=input("what's your
1.先列印8的乘法表:for looper in [1,2,3,4,5]: print looper," times 8 = ",looper*8for looper in range (1,5): print looper,"times 8 =",looper*8for looper in range (1,10): print looper,"times 8 =",looper*8結果:>>> ===============================
print"\n\n************contiue*********************"for i in range (1,6): print print 'i =',i, print 'hello,how', if i ==3: continue print 'are you today?'print"\n\n************break**********************" for i in range (1,6):
print "My",print"name",print "is",print"Dave."運行結果:>>> ================================ RESTART ================================>>> My name is Dave.>>> 把各行末尾的逗號刪去:print "My"print"name"print
print "This program converts Fahrenheit to Celsius"print "Type in a temperature in Fahrenheir:",fahrenheir=float(raw_input())#使用float(raw_input())從使用者得到溫度(華氏)celsius=(fahrenheir-32)*5.0/9print "That is",celsius,"degrees Celsius"運行結果:>>> ====
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity docoder_3_to_8 is port ( a,b,c,g1,g2a,g2b: in std_logic; y: out std_logic_vector(7 downto 0)); end entity; architecture rtl of docoder_3_to_8