[tut]New to Python? #001

in python •  4 years ago 

Hey Folks,

Are you new in Python? I will Tell you how to make your first steps in this quite easy programming language.

To Install Python unser Ubuntu or Others Debian based distributions simply use APT.

apt Install python3

That should Install all things you need to start learning. As editor you can choose what you want. VS Code, Atom or simply gedit.

I am using vscode, because it was the first i used and it has a built-in command prompt to run the Code with out switching to a terminal.

I also create a directory structure dir my programming use in my home folder.

mkdir ~/dev/Projects

For wach project i create a seperate folder.
Feel free to use your own structure, but remember to change Paths in the examples to fit your own needs.

OK stop talking, start coding.
Start your editor, create a new file, named IT 'tut1.py' and enter the following lines.
Please remember, copy'n'paste is not what you want to so now. The effect of learning ist bigger, when typing the code manually.

def main():
    print ("Hello world\n")

main()

What have we eine with this lines of code?
First we defined the main function with the Keywords def main():
The next line prints the text "Hello World" on the Display and the characters \n tells python to create a new line.
And the last line ist the most important line.
This line runs the main function so the code will BE executed.

When you now run:
python tut1.py
In a terminal in the folder where tut1.py ist found, you can see the words
"Hello World"
in your terminal window.

OK nice thats was all for today.
Feel free to play around with that code and try print multiple Text to the display.

The next Part will follows soon,

So stay tuned and interested!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!