Fadak.IR Fadak Solutions
English Русский العربية فارسی
Articles Management Studies Language


/ Coumputer / Programming

Inferential statistics and probability


 

 

Base Types انواع

string str "One\nTwo" رشته‌ای

integer int عددی

float numeric values with floating decimal points. اعشار

boolean bool True False

Container Types انواع کانتینر

list[1,5,9] فهرست

dictionary dict {"key":"value"}   واژه نامه
{1:"one",3:"three",2:"two",3.14:"π"}

collection set {"key1","key2"} مجموعه
 {1,9,3,0}


    List is a collection which is ordered and changeable. Allows duplicate members.
    Tuple is a collection which is ordered and unchangeable. Allows duplicate members.
    Set is a collection which is unordered, unchangeable*, and unindexed. No duplicate members.
    Dictionary is a collection which is ordered** and changeable. No duplicate members.

 

Conversions  تبدیل 

int("15") → 15

 

list("abc") → ['a','b','c']
dict([(3,"three"),(1,"one")]) → {1:'one',3:'three'}
set(["one","two"]) → {'one','two'}

 

if bool(x)==True: ⇔ if x:
if bool(x)==False:⇔ if not x:

 

if age<=18:
state="Kid"
elif age>65:
state="Retired"
else:
state="Active"

 

 

Integer Sequences

range([start,] end [,step])

range(5)→ 0 1 2 3 4

range(3,8)→ 3 4 5 6 7

range(len(seq))→ sequence of index of values in seq

 

for var in sequence:

for x in range(5):
print(x)

Operations on Lists عملیات روی لیست‌ها

lst.append(val) add item at end
lst.extend(seq) add sequence of items at end
lst.insert(idx,val) insert item at index
lst.remove(val) remove first item with value val
lst.pop([idx])→value remove & return item at index idx (default last)
lst.sort() lst.reverse() sort / reverse liste in place

Operations on Sets

Operators:
| → union (vertical bar char)
& → intersection
- ^ → difference/symmetric diff.
< <= > >= → inclusion relations
Operators also exist as methods.

s.update(s2) s.copy()
s.add(key) s.remove(key)
s.discard(key) s.clear()
s.pop()

Set in Python مجموعه

  1. Initial اولیه

    • Create Set ایجاد مجموعه
      • set1 = set()
      • set2= {1, 2}
    • Add to Set به مجموعه اضافه کنید
      • set1.add(i)
    • Remove from Set حذف از مجموعه
      • set1.remove(1)
    • Update Set به روز رسانی مجموعه
      • set1.discard(1)
  2. Operator عمل کننده

    • Intersection اشتراک
      • set1.intersection(set2)
      • set1& set2
    • Union اجتماع
      • set1.union(set2)
      • set1| set2
    • Difference تفاضل (آنچه در دو مجموعه نیست)
      • set1.difference(set2)
      • set2.difference(set1)
      • set1- set2, set2- set1
    • Symmetric Difference تفاضل متقارن (اجتماع منهای اشتراک)
      • set1.symmetric_difference(set2)
      • set1^ set2
    • Product ضرب دکارتی
      • from itertools import product
      • list(product(set1, set2))
  3. Checking چک کردن

    • Membership عضو
      • 1 in set1
    • Disjoint اشتراک تهی است؟
      • set1.intersection(s2) == set()
      • set1& set2== set()
      • set1.isdisjoint(set2)
    • Subset زیرمجموعه
      • s2.issuperset(s1)
      • s1.issubset(s2)
    • Superset پدر
      • s2.issuperset(s1)
      • s1.issubset(s2)
    • Complement (منها کردن)
      • U = set(range(1, 11))
      • s1 = {4, 5, 6}
      • print(U - s1)
    • PowerSet خارج کردن تمام مجموعه‌ها
      • from itertools import combinations as comb
      • s1 = {1, 2, 3, 4}
      • for lng in range(0, len(s1)+1):
      •     print(list(comb(s1, lng)))
  4. Problem
  5. Counting
        - Permutation  جایگشت
        - Combination ترکیب
        - Combination with Replacement
        - Product
  6. Generation 
        - Repeat
        - Count
        - Cycle
  7. Merging 
        - Accumulate
        - Chain

Articles
Digital Media
Humanities
IT Management
Coumputer
Miscellaneous
Product & Services
About Fadak
Management
Contemporary Management Journal
Managerial Verses
Photography Quotes
Photo is written
Management Researcher Bank
Management articles titles
Educational Resources (Seminary & University)
Studies
Observatory - Personalities
Observatory - Cultural
Observatory - Academic
Observatory - Media
Observatory - scientific events
Language
Dictionary
Russian Language Test
Russian Proverb
English Proverb
Four language sentences
logo-samandehi
About | Contact With Us | Privacy Policy | Terms | Cookies Policy |
Version (Pre-Alpha) 2000-2022 CMS Fadak. ||| Version : 5.2 ||| By: Fadak Solutions Old Version