Skip to content

Latest commit

 

History

History
66 lines (43 loc) · 2.87 KB

File metadata and controls

66 lines (43 loc) · 2.87 KB

Learn Python with Let Us DevOps

Day 1: Basic constructs like data structure and loops[for and while]

If you are starting to learn any programming language, you generally start with hello world. This is a simple task of printing the hello world in that particular language. In Python its just 1 line

print('Hello World")
  • Then you move to other important constructs of the programming language. These constructs or basics can be different data types, how to write a function, how to loop over elements etc.

  • So your 1st day is dedicated to learning these constructs. I am assuming all of you are working in linux so need to install Python. It will be pre installed. If you are using Windows, its your headache to install python[don't be angry I said this because I recommend every DevOps person to use linux in their day to day use.]

Task 1: Learn how you can create a string, an integer and an array.

  • This video should help you in learning about data types: Data Types in Python: LetUsDevs

  • It is a lengthy video watch it at 1.5x speed.

  • Write a program to initialize string, int variable and use them.

Task 2: Learn how you can loop through a list of elements.

  • Try to create an array of element and loop over it.

  • Practice: Try to generate table to 2,3,4 and 5

  • You can read about loops here: Loops in Python: LetUsDevOps

There are two ways to loop through an array. Look at the example below

list = [1,2,3,4]
for i in list: 
    print(i)

and

list = [1,2,3,4]
i = 0
for i in range(len(list)):
    print(list[i])
  • Try to find out what is the difference between two and when to use which one.

  • You can do the same with while loop.

Task 3: WAP to generate odd and even numbers with for and while loops.

  • Two programs to generate even and then odd.
  • You can also try solving fizzbuzz problem as an extended goal.

If you are not able to any of the program you can simply type the problem and you will find the code on google.

Learning how to Google is a very important tasks. Let's try to sharpen that skill with these exercises.

Online Problems that you can try solving:

  1. Python Loops
  2. Python Lists
  3. Python Strings

Try to practice them and put it on Github. With this you will learn a lot of new things that are used in DevOps. Push your code to different branches and raise MR and then merge them.

This is it for Day 1. All the best!