no way to compare when less than two revisions

تفاوت‌ها

تفاوت دو نسخهٔ متفاوت از صفحه را مشاهده می‌کنید.


courseware:python_programming:resources:code:5 [2022/07/19 17:51] (فعلی) – ایجاد شد - ویرایش خارجی 127.0.0.1
خط 1: خط 1:
 +===== مثال‌هایی از کار با دیکشنری =====
  
 +<code python line-numbers="true">
 +# dict declaration
 +empty_dict = dict()
 +another_empty_dict = {}
 +
 +people = {
 +    "masoud": {'position': 'teacher', 'age': 21},
 +    "hasan": {'position': 'student', 'age': 22},
 +    "taghi": {'position': 'programmer', 'age': 23},
 +    "asghar": {'position': 'artist', 'age': 24}
 +}
 +people["masoud"]['phone'] = '09121231231'
 +
 +print(list(people.keys()))
 +print(list(people.values()))
 +
 +for person_k, person_v in people.items():
 +    print(person_k, '->', person_v)
 +
 +</code>