原创 [Python3] 集合
# set(集合),與dict類似,區別是隻有鍵key沒有值value # 用set函數創建一個set,需要提供一個list作爲輸入集合 s = set([1, 2, 3, 4, 'str', 1.2341]) print(s) #
原创 [Python3] for-in while循環語句
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ################################################################## #
原创 [Python3實例] turtle庫的使用
Turtle庫基本使用方法 方法 功能 turtle.forward(distance) 向當前畫筆方向移動distance像素長度 turtle.backward(distance) 向當前畫筆相反方向移動dista
原创 [Python3] if-elif-else條件語句
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # if else練習 height = 1.75 weight = 60.5 bmi = weight / (height * he
原创 [Python3] assert關鍵字
assert : 斷言 爲什麼使用assert 程序員斷定這個程序執行之後或者之前會有這樣的結果,如果不是,那就扔出一個錯誤。 語法: assert 表達式 [, 參數] 參數是一個字符串,用於拋出錯誤同時顯示 作用是判斷表達式是否
原创 [Python3] 列表
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ################################################################## cla
原创 第一個Python3程序
# 1st.py print('+++++++++++加法計算器+++++++++++') numa = int(input('輸入第一個數')) numb = int(input('輸入第二個數')) result = numa +
原创 [Python3] dict 字典數據類型
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ################################################################## #