程式設計第一週個人筆記
1.運算子:
+代表"加"
-代表"減"
*代表"乘"
/代表"除"
%代表"餘數"
**代表"平方"
//代表"忽略答案有小數點的除法"
ex: x=10
y=3
1.print(x%y)=1
2.print(x//y)=3
2.運算子:
=的例子: x=x
+=的例子: x=x+y
-=的例子: x=x-y
*=的例子: x=x-y
/=的例子: x=x/y
%=的例子: x=x%y
**=的例子: x=x**y
//=的例子: x=x//y
ex: x=4
x**=2
print(x)=16
3.運算子:
==代表"等於"
!=代表"不等於"
>代表"大於"
<代表"小於"
>=代表"大於等於"
<=代表"小於等於"
ex: x=6
y=5
1.print(x>=y)
true
2.print(x<=y)
false
4.運算子:
and代表"兩者皆成立"
or代表"兩者任一成立即可"
not代表"與結果相反"
ex: x=3
print(x>1 or x<2)
true
5.運算子:
is代表"判斷兩個變量引用的對像是否為同一個"
is not代表"判斷兩個變量引用的對象是否為不同個"
ex: x=["1","2"]
y=["1","2"]
z=x
1.print(x is not z)
false
2.print(x is not y)
true
3.print(x != y)
false
6.運算子:
in代表"在指定的序列中找到值返回true,否則返回false"
not in代表"在指定的序列中沒有找到值返回true,否則返回false"
ex: x=["5","10"]
print("5" in x)
true
{"metaMigratedAt":"2023-06-16T20:09:36.214Z","metaMigratedFrom":"Content","title":"Untitled","breaks":true,"contributors":"[{\"id\":\"07a2a4c8-1664-444d-a7e2-68bed428ef81\",\"add\":1042,\"del\":100}]"}