Python - Basics

ยท

2 min read

So moving forward with my #90daysofdevops Day 13 and Day 14 challenge today I have learned the basics of Python and brushed up some concepts that are required.

The different data structures in Python are,

StringListTupleSetDictionary
TypeImmutableMutableImmutableMutableMutable
Syntax"text"[item1, item2, ..., itemN](item1, item2, ..., itemN){item1, item2, ..., itemN}{key1: value1, key2: value2, ...}
IndexingAccess via index (0-based)Access via index (0-based)Access via index (0-based)No indexingAccess via key
OrderingOrderedOrderedOrderedUnorderedUnordered
DuplicatesDuplicates allowedDuplicates allowedDuplicates allowedNo duplicates allowedDuplicates allowed
ModificationImmutable (Cannot change individual characters)Mutable (Can add, remove, and modify elements)Immutable (Cannot change individual elements)Mutable (Can add and remove elements, but cannot modify)Mutable (Can add, remove, and modify key-value pairs)
Example"Hello, World!"[1, 2, 3, 4](1, 2, 3, 4){1, 2, 3, 4}{"name": "John", "age": 30, "city": "New York"}

Note: The table provides a general overview of the differences between these data structures, but there might be additional details and functionalities for each that are not mentioned here.

Here are some of the basic tasks I have completed using python

  1. Create the below Dictionary and use Dictionary methods to print your favorite tool just by using the keys of the Dictionary.
fav_tools = 
{ 
  1:"Linux", 
  2:"Git", 
  3:"Docker", 
  4:"Kubernetes", 
  5:"Terraform", 
  6:"Ansible", 
  7:"Chef"
}

  1. Create a List of cloud service providers eg.
cloud_providers = ["AWS","GCP","Azure"]

Write a program to add Digital Ocean to the list of cloud_providers and sort the list in alphabetical order.

I am grateful for the valuable knowledge gained during this journey, and I look forward to diving deeper into Python! Stay tuned for more exciting updates! ๐ŸŽ‰๐ŸŒŸ

#DevOps #Git #GitHub #VersionControl #CodingJourney #LearningInProgress #python

ย