قسمت 21،22،23.rar
165.8 MB
🌟🔴 آموزش کامل رزبری پای و لینوکس قسمت 21,22,23 (زبان انگلیسی)
@raspberry_python
@raspberry_python
#آموزش 11 #پایتون
حذف موارد تکراری از یک دنباله در حالی که نظم قبلی حفظ شود👇
def dedupe(items):
seen = set()
for item in items:
if item not in seen:
yield item
seen.add(item)
if name == '__main__':
a = [1, 5, 2, 1, 9, 1, 5, 10]
print(a)
print(list(dedupe(a)))
out put :
[1, 5, 2, 1, 9, 1, 5, 10]
[1, 5, 2, 9, 10]
حذف موارد تکراری از یک دنباله در حالی که نظم قبلی حفظ شود👇
def dedupe(items):
seen = set()
for item in items:
if item not in seen:
yield item
seen.add(item)
if name == '__main__':
a = [1, 5, 2, 1, 9, 1, 5, 10]
print(a)
print(list(dedupe(a)))
out put :
[1, 5, 2, 1, 9, 1, 5, 10]
[1, 5, 2, 9, 10]
#آموزش ۱۲
کمی با ریاضیات در پایتون😉
import math
sin(pi/4)→0.707…
cos(2*pi/3)→-0.4999…
sqrt(81)→9.0
log(e**2)→2.0
ceil(12.5)→13
floor(12.5)→12
🆔 @raspberry_python
کمی با ریاضیات در پایتون😉
import math
sin(pi/4)→0.707…
cos(2*pi/3)→-0.4999…
sqrt(81)→9.0
log(e**2)→2.0
ceil(12.5)→13
floor(12.5)→12
🆔 @raspberry_python
#آموزش ۱۳
🌟 برخی از تبدیلات کاربردی در پایتون
📌int("15") → 15
📌int("3f",16) → 63
📌int(15.56) → 15
📌float("-11.24e8") → -1124000000.0
📌round(15.56,1)→ 15.6
📌repr(x)→ "…"literal representation string of x
📌bytes([72,9,64]) → b'H\t@'
📌list("abc") → ['a','b','c']
📌dict([(3,"three"),(1,"one")]) → {1:'one',3:'three'}
📌set(["one","two"]) → {'one','two'}
📌 ':'.join(['toto','12','pswd']) → 'toto:12:pswd'
📌"words with spaces".split() → ['words','with','spaces']
📌"1,4,8,2".split(",") → ['1','4','8','2']
📌[int(x) for x in ('1','29','-3')] → [1,29,-3]
🆔 @raspberry_python
🌟 برخی از تبدیلات کاربردی در پایتون
📌int("15") → 15
📌int("3f",16) → 63
📌int(15.56) → 15
📌float("-11.24e8") → -1124000000.0
📌round(15.56,1)→ 15.6
📌repr(x)→ "…"literal representation string of x
📌bytes([72,9,64]) → b'H\t@'
📌list("abc") → ['a','b','c']
📌dict([(3,"three"),(1,"one")]) → {1:'one',3:'three'}
📌set(["one","two"]) → {'one','two'}
📌 ':'.join(['toto','12','pswd']) → 'toto:12:pswd'
📌"words with spaces".split() → ['words','with','spaces']
📌"1,4,8,2".split(",") → ['1','4','8','2']
📌[int(x) for x in ('1','29','-3')] → [1,29,-3]
🆔 @raspberry_python