原创 python基礎學習筆記(一)——數據類型stdtypes和列表list

機器之心整理 參考python官方說明 chaper3 數字和字符串 數字: 分爲int和float,可以相互轉換。 注意:在int型數字計算平均值的過程中,無論計算結果是整數還是浮點數,結果都爲float型。 關於布爾型 字符串 計

原创 NumPy學習筆記

NumPy的學習過程主要是運行一些簡單的例程,用以表明各函數的作用。 學習資料參考來自:runoob網站

原创 python習題練習(八)

參考書籍:python程序設計 chapter10. 3. #This pro let user choose a button and show the result(right or wrong). from button impo

原创 python習題練習(七)

參考書籍:python程序設計 chapter9 1. from random import random def main(): printIntro() probA, probB, n = getInputs()

原创 python習題練習(六)

參考書籍:python程序設計 chapter8. test from graphics import * def handlekey(k, win): if k == "r": win.setBackgrou

原创 python習題練習(五)

參考書籍:python程序設計 chapter7 5. #This pro print the healthy level based on the BMI. #input:weight(kg), and height(cm). #ou

原创 python習題練習(四)

參考書籍:python程序設計 chapter6. test #happy2.py #This pro is a exercise in the book. def happy(): return "Happy Birthday

原创 python習題練習(三)

參考書籍:python程序設計 chapter5 1. def main(): print("This pro converts the date.") #input date = input("Please

原创 python習題練習(二)

參考書籍:python程序設計 chapter4 1. from graphics import * def main(): win = GraphWin() shape = Rectangle(Point(10,10

原创 python習題練習(一)

參考書籍:python程序設計 chapter 1 5. print("This program illustrates a chaotic function") x = eval(input("Enter a number betwe

原创 python繪圖基礎

參考網頁 https://blog.csdn.net/anneqiqi/article/details/64125186 https://blog.csdn.net/helunqu2017/article/details/78614640

原创 python基礎學習筆記(六)——迭代器iterators和生成器generators

注意python的編程習慣,定義函數的空行和數學符號前後的空格。 chapter9 迭代器     官方文檔    參考網頁 迭代器是一個帶狀態的對象,在調用next()方法的時候返回容器中的下一個值,否則進入休眠狀態等待被調用。 ite

原创 python基礎學習筆記(四)——字典dictionary

chapter7 字典 字典是一種類似於列表的數據結構,不同之處在於用自定義的關鍵字作爲數據的索引,且每個關鍵字下的數據內容可爲多個。 注意列表的定義格式(此處用字符串作爲字典的索引) ages={ "Peter":10,

原创 python基礎學習筆記(二)——數學模塊math modules和(遞歸)函數functions

chapter5 模塊和函數 math模塊    參考 模塊的數學運算由C語言的標準庫定義,永久有效。只支持實數運算,cmath模塊支持複數運算。返回結果大部分爲浮點型。 具體各函數作用 math.gcd()函數,計算兩個數的最大公約數。

原创 python基礎學習筆記(五)——類和繼承class

類class 面向對象的程序設計中的一種數據結構,內部包括數據(屬性)和函數(對屬性進行操作)。 面向對象的程序設計三個特性:封裝、繼承和多態,是基於類和對象的操作。 注意類的定義格式,每個類都包括一個初始化函數(構造函數)來初始化數據。