close

Adnroid QPython 版本:

-----------------------------------------------------------------------------

import sl4a
import time
global A
A=["十","一","二","三","四","五","六","七","八","九"]

droid=sl4a.Android()
def ssp(w):
    droid.ttsSpeak(w)
    print (w)
def sp(i):
    if i<10:
        ssp(A[i])
    else:
        k=i//10
        if k>1:
            sp(k)
        ssp(A[0])
        s=i%10
        if s > 0:
            sp(s)
        
for x in range(2,10):
    for y in range(1,10):
        sp(x)
        sp(y)
        sp((x*y))
        print (" ")
        time.sleep(2)     
        

-------------------------------------------------------------------------------

Windows python 2.7 版本: (要裝   pywin32 Source Forge  )
http://downloads.sourceforge.net/project/pywin32/pywin32/Build%20220/pywin32-220.win32-py2.7.exe

--------------------------------------------------------------------------------

# -*- coding: big5 -*-
import win32com.client
import time
global A
A=["十","一","二","三","四","五","六","七","八","九"]
speaker = win32com.client.Dispatch("SAPI.SpVoice") #連接SAPI
SVSFDefault = 0
SVSFlagsAsync = 1
speaker.Volume = 100
speaker.Rate = 0

def ssp(w):
    speaker.Speak(w)
def sp(i):
    if i<10:
        ssp(A[i])
    else:
        k=i//10
        if k>1:
            sp(k)
        ssp(A[0])
        s=i%10
        if s > 0:
            sp(s)
        
for x in range(2,10):
    for y in range(1,10):
        sp(x)
        sp(y)
        sp((x*y))
        print (" ")
        time.sleep(2)

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 echochio 的頭像
    echochio

    echochio

    echochio 發表在 痞客邦 留言(0) 人氣()