電腦做什麼事~第七章



Similar documents
./



循经指压疗法

Microsoft Word - HERBRECIPES《中國藥膳》.doc

毛主席的猪

附件1.FIT)

!

!

Microsoft Word - 變形記

Microsoft Word - [术数]《八卦象数与疾病预测》黄鉴.doc

第 一 章 : 從 中 共 解 放 軍 投 奔 藏 軍 棄 家 從 軍 我 原 名 姜 華 亭, 藏 名 羅 桑 扎 西, 家 在 中 國 山 東 省 萊 陽 縣 九 區 孟 格 莊 村, 父 親 叫 姜 昆, 母 親 叫 李 秀 芳 家 中 以 務 農 為 業 解 放 前 後, 父 親 曾 在 三


Microsoft Word - 成长的痕迹散文集.docx

Microsoft Word - 席慕容散文集.doc

<4D F736F F D20D6D0B9FABDDAC8D5CEC4BBAF2DB5BECCEF2E646F63>

七 以 自 然 風 光 為 紋 飾 第 六 章 中 國 歷 代 民 間 藏 瓷 鑒 定 術 語 第 七 章 中 國 古 瓷 文 獻 選 一 窯 器 說 ( 清 ) 程 哲 著 二 景 德 鎮 陶 歌 序 言 我 與 春 恩 先 生 相 識 經 年, 且 為 同 好, 瓷 道 摯 友 春 恩 為 人

(\244j\257d\276\307\274\351_ C.indd_70%.pdf)

Python a p p l e b e a r c Fruit Animal a p p l e b e a r c 2-2

6寸PDF生成工具

< A67E38A4EBA6DC39A4EB>

丁无悔

042-

019-

025-

親鸞和懺悔道的哲學

027-

<4D F736F F D EA16DBB50B3AFA742A4A7AED1A16EBD67A6AEA4CEA8E4C3C0B34EAF53A6E2B1B4AA522D2DB3B9A5BFA9BE5F702E34332D35345F2E646F63>

浙 江 财 经 大 学 891 统 计 学 全 套 考 研 资 料 <2016 年 最 新 考 研 资 料 > 浙 江 财 经 大 学 统 计 学 891 全 套 考 研 资 料...22 浙 江 财 经 大 学 高 等 数 学 601 全 套 考 研 资 料

Microsoft Word 司仲敖.doc

Microsoft Word - Book 11 人道行.doc

山 东 财 经 大 学 431 金 融 学 综 合 全 套 考 研 资 料 <2016 年 最 新 考 研 资 料 > 2-2 金 融 学 笔 记, 由 考 取 本 校 本 专 业 高 分 研 究 生 总 结 而 来, 重 点 突 出, 借 助 此 笔 记 可 以 大 大 提 高 复 习 2-3 金

Microsoft Word - Book 2 月下行.doc

盐 田 区 2015 年 社 会 建 设 行 动 计 划 2015 年 是 全 面 深 化 改 革 的 关 键 之 年 全 面 推 进 依 法 治 区 的 开 局 之 年, 也 是 十 二 五 规 划 的 收 官 之 年 十 三 五 规 划 的 谋 划 之 年 结 合 省 市 年 度 社 会 工 作

Microsoft Word - _二_-1-2D研習講義-孫藝玨.doc

zt

Microsoft Word - Book 3 巫山行.doc

Microsoft Word - 【預官_士_考選歷屆試題86~100】.doc

一、银行结售汇业务

田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田有關田

<4D F736F F D BEC7A67E2DB5A7B8D52DBB79A4E5AFE0A44FB4FAC5E7BEE3A658A5FE2E646F63>

第 一 部 分 目 录 销 售 管 理 规 范 汇 编... 5 Ⅰ 销 售 资 格 管 理 篇 关 于 保 险 公 司 销 售 人 员 资 格 管 理 的 规 定 关 于 银 邮 代 理 机 构 代 理 资 格 管 理 的 规 定 关 于 银 邮

Microsoft Word - 台東縣文學.doc

第 1 頁 C97131 第 一 部 分 : 選 擇 題 ( 佔 54 分 ) 一 單 選 題 ( 佔 36 分 ) 說 明 : 第 1 題 至 第 18 題, 每 題 選 出 一 個 最 適 當 的 選 項, 標 示 在 答 案 卡 之 選 擇 題 答 案 區 每 題 答 對 得 2 分, 答 錯

第 1 頁 C97232 第 一 部 分 : 選 擇 題 ( 佔 55 分 ) 一 單 選 題 ( 佔 34 分 ) 說 明 : 第 1 至 第 17 題, 每 題 選 出 一 個 最 適 當 的 選 項, 劃 記 在 答 案 卡 之 選 擇 題 答 案 區 每 題 答 對 得 2 分, 答 錯 或

蘇轍〈黃州快哉亭記〉析論

一 緒 論 ( 一 ) 研 究 動 機 及 目 的 中 國 唐 代 為 佛 教 發 展 輝 煌 時 期, 其 中 禪 宗 也 是 當 時 鼎 盛 流 行 的 宗 派 之 一 本 文 主 要 在 探 討 馬 祖 道 一 (709~788, 以 下 簡 稱 馬 祖 ) 所 傳 承 的 洪 州 禪 ( 又



Transcription:

Batteries included 1 built-ins #-*- coding: UTF-8 -*- from getpass import getpass data = {"kaiching":"0000"} def hello(name): " ", name, " " name = raw_input(" ") word = getpass(" ") if data.has_key(name): if word == data[name]: hello(name) " " " " raw_input(" <Enter> ")

Batteries included 2 math import math def result(number): " %.2f %d" %(number, int(math.ceil(number))) " %.2f %d" %(number, int(math.floor(number))) "%.2f 2 log %.2f" %(number, math.log(number, 2)) "%.2f %.2f" %(number, math.sqrt(number)) "%.2f %.2fπ" %(number, math.radians(number)/math.pi) "sin(%.2f) = %.2f" %(number, math.sin(math.radians(number))) "cos(%.2f) = %.2f" %(number, math.cos(math.radians(number))) "tan(%.2f) = %.2f" %(number, math.tan(math.radians(number))) while True: try: number = float(raw_input(" 0 360 ")) if number < 0: "..." number = math.fabs(number) if number > 360: " 360 " raise ValueError result(number) break elif number > 360: raise ValueError

Batteries included 3 result(number) break except ValueError: " " raw_input(" <Enter> ") Note time #-*- coding: UTF-8 -*- from time import sleep, asctime weeks = {"Mon":" ", "Tue":" ", "Wed":" ", "Thu":" ", \

Batteries included 4 "Fri":" ", "Sat":" ", "Sun":" "} months = {"Jan":" ", "Feb":" ", "Mar":" ", "Apr":" ", \ "May":" ", "Jun":" ", "Jul":" ", "Aug":" ", \ "Sep":" ", "Oct":" ", "Nov":" ", "Dec":" "} moment = asctime() def now(): " ", moment[20:], " ", months[moment[4:7]], moment[8:10], " ", weeks[moment[:3]] " ", moment[11:19] now() "..." i = 10 while i > 0: " ", i, " ", sleep(1) "\r", i = i - 1 "... " " ", asctime()[11:19] raw_input(" <Enter> ")

Batteries included 5 Note sys #-*- coding: UTF-8 -*- from sys import exit, platform, version def whatplatform(): if platform == "win32": " MS-Windows " elif platform == "linux2": " Linux " elif platform == "darwin": " Mac " " " def fun1(): " " def fun2():

Batteries included 6 " " whatplatform() " Python ", version[:5] while True: "(1)..." "(2)..." c = raw_input(" q ") if c == "1": fun1() elif c == "2": fun2() elif c == "q": exit() " 1 2 q " Note

Batteries included 7 os #-*- coding: UTF-8 -*- from sys import exit, platform, version from os import system def whatplatform(): if platform == "win32": " MS-Windows " elif platform == "linux2": " Linux " elif platform == "darwin": " Mac " " " def clear(): if platform == "win32": return "cls" elif platform == "linux2" or "darwin": return "clear" return False def fun1(): try: system(clear()) " " except TypeError: "..." " " def fun2(): try: system(clear()) " " except TypeError: "..." " " def main():

Batteries included 8 while True: try: system(clear()) "(1)..." "(2)..." c = raw_input(" q ") if c == "1": fun1() elif c == "2": fun2() elif c == "q": exit() " 1 2 q " except TypeError: "..." "(1)..." "(2)..." c = raw_input(" q ") if c == "1": fun1() elif c == "2": fun2() elif c == "q": exit() " 1 2 q " whatplatform() " Python ", version[:5] main()

Batteries included 9

Batteries included 10 Note random #-*- coding: UTF-8 -*- from random import randint answer = randint(1,99) " " state = True while state: try: guess = int(raw_input(" 1 99 ")) if guess == answer: " " state = False elif answer < guess < 100: " " elif 0 < guess < answer: " "

Batteries included 11 raise ValueError except ValueError: " 1 99 " raw_input(" <Enter> ") Note