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.]
-
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.
-
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
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.
- 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.
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.