Python codes (Part 4)

 Some Codes for Practicing in Python

1.  favorite_languages = {

     'jen' : 'python',

     'sarah' : 'c',

     'edward' : 'ruby',

      'phil' : 'python',

      }

      for key, value in favorite_languages.items():

      print("\nKey: " + key.title())

      print("Value: " + value.title())

      for key in favorite_languages.keys():

      print("\nKey: " + key.title())

     for value in sorted (favorite_languages.values()):

     print("Value: " + value.title())

---------------------------------------------------------------------------------------------------------------------

2. student_0 = {'name' : 'hassan', 'roll' : '47'}

    student_1 = {'name' : 'sakib', 'roll' : '50'}

    student_2 = {'name' : 'Hossian', 'roll' : '52'}

    students = [student_0 , student_1 , student_2 ]

    for student in students:

    print(student)

----------------------------------------------------------------------------------------------------------------------

3. favorite_languages = {

   'jen' : ['python', 'ruby'],

   'sarah' : ['c'],

   'edward' : ['ruby', 'go'],

   'phil' : ['python', 'haskell'],

    }

   for key, values in favorite_languages.items():

   print("\nKey: " + key.title())

   for value in values:

   print("Value: " + value.title())


Comments

Popular posts from this blog

Hajir Biriyani with recipes

Freelancing

Python Programming Language & Used for