LEARNING PYTHON FROM FIRST STEPS


In this post I will show how I start to learn Python. I started with Python programming because one of the YouTube blogger recommended and indeed this language is one of the most exciting and easy and with this programming language need to start! I learn programming from teenage years. I started with HTML and CSS, C ++, C #, Pascal and now decided to learn Python. With this language you can make mobile apps, computer programs, games, web sites, plugins and much more. This is powerful programming language, that can make practically anything. In the future I will like to learn JavaScript, PHP and different programming languages.

First seps

For first use you need to install Python, to do this go to official site: https://www.python.org/
and download latest version choosing your operating system.

Second what you need to do is use one of IDE you like, for example: Komodo Edit, Visual Studio Code, Thonny. I'm using Komodo Edit because I like the interface and it is for free.


Let's start coding

Like in all coding languages first need to make your first "Hello world!" program. Then we can make calculator and then we can program something more complicated. I have some ideas about what can make, but we will see, what kind of program I create.


It's very simple, just write in Komodo editor: print("Hello world!") and run in cmd command line: python print.py. I have made on D: drive Python folder and saved the print.py file there!

Let's make a simple calculator

This calculator will be made to allow the user to enter the action (count, subtract, multiply or divide), then enter the first, second number and then the output result. Just enter this code:

what = input( "Choose an action (+, -, *, /): " )

a = float( input("Enter first number: ") )
b = float( input("Enter second number: ") )

if what == "+":
c = a + b

if what == "-":
c = a - b
if what == "*":
c = a * b
if what == "/":
c = a / b

print("Result: " + str(c))


To open the created calculator, we need open cmd and run our program (python calc.py) in the command line. The result will be a decimal number if the user is going to write with decimal numbers.

This was a small insight into the programming language: Python. In the following articles, we will look at more complex programs as well as the visual interface. Good luck and get fun with Python! :)







Comments

  1. https://www.youtube.com/watch?v=BHh654_7Cmw

    ReplyDelete
    Replies
    1. Hi, yea that's cool game. If you interest, check this tutorial (http://bit.ly/2IPndT9) where can make a snake on Python!

      Delete

Post a Comment

Popular Posts