2023年6月13日
摘要:
1 class Account: 2 def __init__(self, name, account_number, initial_amount = 10): 3 self._name = name 4 self._card_no = account_number 5 self._balance
閱讀全文
posted @ 2023-06-13 20:12
辣椒味蒲公英
閱讀(9)
推薦(0)
2023年6月11日
摘要:
task 1_1 from turtle import * def move(x,y): '''畫筆移動到坐標(x,y)處''' penup() goto(x,y) pendown() def draw(n,size = 100): '''繪制邊長為size的正n變形''' for i in ran
閱讀全文
posted @ 2023-06-11 20:45
辣椒味蒲公英
閱讀(21)
推薦(0)
2023年6月6日
摘要:
1 with open('data6.csv','r',encoding='gbk') as f: 2 data1 = f.read().split('\n') 3 del data1[0] 4 print('原始數據:') 5 print(data1) 6 7 for i in range(len
閱讀全文
posted @ 2023-06-06 20:42
辣椒味蒲公英
閱讀(17)
推薦(0)
2023年5月24日
摘要:
print(sum) sum = 42 print(sum) def inc(n): sum = n+1 print(sum) return sum sum = inc(7) + inc(7) print(sum) 四處sum作用域不同。第一個是內置函數名稱,第二個是賦值名稱,第三個是局部變量,第四
閱讀全文
posted @ 2023-05-24 20:10
辣椒味蒲公英
閱讀(17)
推薦(0)
2023年4月25日
摘要:
import random print('用列表儲存隨機整數:') lst = [random.randint(0,100) for i in range(5)] print(lst) print('\n用整數儲存隨機整數:') s1 = {random.randint(0,100) for i i
閱讀全文
posted @ 2023-04-25 12:41
辣椒味蒲公英
閱讀(20)
推薦(0)
2023年3月26日
摘要:
1 # 字符串的基礎操作 2 # 課堂上沒有演示的一些方法 3 4 x = 'nba FIFA' 5 print(x.upper()) #字符串轉大寫 6 print(x.lower()) #字符串轉小寫 7 print(x.swapcase()) #字符串大小寫翻轉 8 print() 9 10
閱讀全文
posted @ 2023-03-26 18:44
辣椒味蒲公英
閱讀(26)
推薦(0)
2023年3月12日
摘要:
1 # print輸出的幾種用法 2 # 用法1:用于輸出單個字符串或單個變量 3 print('hey,u') 4 5 # 用法2: 用于輸出多個數據項,用逗號分隔 6 print('hey','u') 7 x,y,z = 1,2,3 8 print(x,y,z) 9 10 # 用法3: 用戶混合
閱讀全文
posted @ 2023-03-12 21:05
辣椒味蒲公英
閱讀(17)
推薦(0)