Tuesday, June 7, 2022

๐Ÿ‘‰Python 1.1๐Ÿ‘ˆ

  


Hi everyone, hope you all had a great time and would have been looking forward to the next blog (please don't say you didn't care if I went missing). So, I will try to be more regular now onwards and will try my best to make easy and informative tutorials. In previous blog, we got familiar with Python, its advantage and usage. Now onwards, I'll try to explain the coding aspect of this awesome language.
 
Basics of Python:

Every language has different data types to store the input. Data type is a kind of classification to categorize different type of data. For example, data can be integer, a decimal value, a string, etc.  There are other complex data types which we will explore some blogs later when we develop enough understanding of the language. To understand the most basic data types, let's dive in:
 a) Int :- Any integer value (positive and negative both) has the data type "int" in python.   Eg: 417, -536
 b) Float : - All the decimal values are of the data type "float". 
Eg:  2639.78, -72.91437
c) String :-  A combination of English alphabets is said to have data type "string". They need not be meaningful words. A single alphabet too will be considered of type "string".        Eg:  r, cefxrz, hello world, etc.

Do you want to try writing simple code yourself? In order to run a program, we must make the computer understand the commands we are passing. To make any code work , we need to execute or run the program in a  suitable environment. We call them IDE, which stands for Integrated Development Environment. They have necessary settings and configuration which offers the users to run their program. Some common Python IDE are Pycharm, IDLE, Visual Studio Code, Sublime Text, etc. Installing them for the first time on system can be intimidating for beginners so let's do it some other time, once we have become confident with the language. For now, we may use any online IDE. These are many websites which offer free IDE for a variety of languages. I generally prefer codechef. You may also give it a try and do let me know your favorite IDEs in the comments. So, you can access Codechef's online IDE from this link.




The most basic program in any language is to print something. In python, we use the keyword "print" to display the output on screen . 
And in order to know the data type of any input, we can use the keyword "type". We will start with coding some basic programs which will involve printing certain input and it's data type from user. We will use the "type" keyword as well to understand how it works.

To print any string, we need to pase it between double quotes, viz, " ".   Eg:-
                      print ("Hello World!") 
                            print(type("Hello World!") )


             ๐Ÿ‘‰ print (" xyzlexbir")
                          print(type(" xyzlexbir"))๐Ÿ‘ˆ



Now, let's play with numbers. Numbers are passed without any double quotes. Eg:-
             
              print (-5134.26) 
                  print(type(-5134.26))
           
            
        ๐Ÿ‘‰  print(453.79) 
                    print(type(453.79))
                    print (23) 
                    print(type(23))๐Ÿ‘ˆ
             
                                print(-967876324517) 
                                    print(type(-967876324517))

All you need to do is select the correct language from dropdown, type the code in the blank area and then hit on "Run" button. 
     So, copy the above code and go to IDE of your choice, paste it click on "Run" and see  your first program in Python. 

 Congratulations!! You did it!! ✨✨๐Ÿ˜ƒ

In next blog, we will try to write a dynamic program. What is that? Let's find out in next blog.

Stay tuned for more fun and learning!!  ✌✌            

Until then, Hasta la Pasta!!๐Ÿค 

Take care and stay Healthy!!๐Ÿ˜Š



  

Python for beginner

How to download (IDLE python).✨

            @pythonguru26 H i everyone,๐Ÿ˜Š hope you all had a great time and would have been looking forward to the next blog (please don...