Wednesday, 25 May 2016

Learn Python the easy way - 4. String Operators

Input function

  The input function is used to gather input from user. It's mainly useful in actual programming world. This input function prompts the user for input and returns what they entered.

>>>input("What is your favorite programming language:")
What is your favorite programming language: Python

'Python'

Concatenation

Concatenation is nothing but an addition of two or more strings. This can be done by adding mathematical operators in between the strings.

>>>"Hello"+"World"
'HelloWorld'

As you can see, it adds two strings. You can use single quotes or double quotes, both will works. 
In this concatenation, If your string contains numbers it takes as string and not as an integer.

For example,

>>>"43" + "4" + "1"
'4341'

You can also multiply strings by using integers.

>>>print("Hello" * 4)
HelloHelloHelloHello
   

Type Conversion

The problem is getting input from user is probably as in the form of strings. In order to make it as an integer, we use the concept of type conversion.
For an example, take the following code;

>>>int(input("Enter a number:")) * int(input("Enter another number:")) 
Enter a number: 3
Enter another number: 2
6

Tuesday, 17 May 2016

Fedora 24 Graphical Upgrade Test Day - Red Hat, Bangalore

I got my first exposure to the Fedora community and open source contribution. It was an exciting event held on the 16th of May 2016 at Red Hat, Bangalore. In total, there were four people attending the event in person. Many others attended the event through Hangout &IRC. Sumantro (QA Intern), Karthik (Storage Intern) , two new open source enthusiasts (Vipul Siddharth and Prakash Mishra) and I attended the event at the Red Hat office in Bangalore.

Vipul Siddharth and Prakash Mishra had come from Christ University, Bangalore. They have a keen interest in contributing to open source technologies. Sumantro deserves a special mention. He mentored the new comers and also took us through the entire Red Hat enterprise workflow operations.







The Fedora Graphical Upgrade procedure is here. We were able to make the Fedora Graphical Upgrade test day a success. One great news is that the new comers got a part-time internship opportunity at Red Hat. Congrats Vipul Siddharth and Prakash Mishra! :)

In this event, Each and every one exposure their workflow in Red Hat. I had an opportunity to know the operations of other teams like the storage team and the quality testing team. This event also helped us to group together quality assurance (Sumantro), storage (Karthik) and infrastructure (Me) :) and share our point of views with each other.



We published the result on the Fedora test results page. The link for Fedora test results page is here. In upcoming days, we plan to work on the Fedora release validation testing project. 

Finally I want to say thanks to Sudhir Dharanendraiah (QA Manager). He is organised the Fedora Graphical Upgrade Test Day very well and also helped us a lot.

Monday, 16 May 2016

Learn python the easy way - 3. Strings

String is nothing but an text. The plain text is called as string in programming. It can be done by adding two single or double quotation marks between the text.

>>>"Python is easy!"
'Python is easy'

In string, some characters are cannot be included directly. Because each character in Python has represent something. In order to print that characters as a string, we use escaping character (back slash) \.

for an example

>>>"Hello "How are you"?"
  File "<stdin>", line 1
    Hello "How are you"?"
                      ^
SyntaxError: invalid syntax

To avoid this, add back slash before the character

>>>"Hello, \"How are you\"?"
'Hello,  "How are you"?

New Lines

Add \n to get a new line.

>>>print("Hello \nPython!")
Hello
Python!


Learn Python the easy way - 2. Simple operations

We can use mathematical operations in Python. Enter a calculation directly into Python console, and it will display the answer.

>>>5 + 2
7

>>>6 * 4
24

>>>4 + 1 - 3
2

Note: There is a space should be there in between the operator. It should work with out operator, but it makes easy to read. (operator -> +, - , / and etc; operand -> values such as 3, 4, 7)

Floats

Floats are used in Python to represent numbers that are not integers. There is a dot would be there in float. Example 3.45, 45.4. When you divide something in Python it will give you an floating value.

>>>3 / 4
0.75

>>>8 / 2
4.0

Exponentiation

We can also manipulate exponentiation in Python. It is the raising of one number to the power of another number.

>>2 ** 3
8

These two asterisks equal to ^ (The power symbol).

Quotient and reminder

To determine the quotient

>>>50 // 3
16

To determine the remainder

>>>10 % 4
2

Example (try to solve your self)

>>>78 % (6 // 4)


Learn Python the easy way - 1. Introduction to Python

In this tutorial i will cover the Python language tutorials.

What is Python?

   Python is a high level programming language. which is used in numerous areas like web programming, automating tasks, scripting and artificial intelligence. It is very popular language. It is used in Google, NASA and many organizations.

   Python is processed by runtime by the interpreter. Interpreter is a program that runs scripts written in an interpreted language. There are 3 major versions are available in Python. That is 1.x, 2.x and 3.x. This tutorial i will cover latest version of Python 3.

Installing Python
   
     You can get the Python program from this link. Installation procedure is same as other programs installations.

The Python Console 

     Open your python program, to do this 
     In Linux -> Go terminal -> python3
     In Windows -> Simply get it from the start menu.

First Program

   >>>print('Hello Python!')
Hello Python!

We written our first program :). To exit the python console 
   >>>quit()