DEV Community

Cover image for Python - Simple and beautiful
No Name Pro
No Name Pro

Posted on • Originally published at blog.nonamepro.ga

Python - Simple and beautiful

Hello 👋

I want to show you, what Python works. How to write functions and if's.

I'm new in Python, i previous worked with C# and other languages which have a compiler.

Python don't needs a compiler. It's an script language. The good is, you can code everywhere and just need to run this file.

But if you code a error, for example Syntax-Error, the program neeeds to go to the line. A Compiler check this on compiling and will show it.

Define a variable

# Define a boolean
MyVariable = True

# Define a string
WelcomeText = "Welcome"

# Define a array
Names = ['Some', 'Body']

Print/Write to Console

# Print a defined text
print("I am at the Console!")

# Print a string
print(WelcomeText)

# Print a multiple Strings/Text
print(WelcomeText + ' User')

If-Clauses

if MyVariable == True:
    # Do something

Functions

# Define a new function
def Welcome:
    print(WelcomeText)

# Run Function
Welcome()

For Loops

for user in names:
    print(WelcomeText + ' ' + user)

So yeah 🎉

Python is a beatiful language, what mean formatting.

I think it's easy to understand, and i would use Python for small scripts for Linux, Windows and macOS.

For more help, ask me or search in the world-wide-web.

Oldest comments (2)

Collapse
 
stackneverflow profile image
Linus

First thanks for the interesting post. And a warm welcome to the dev.to community and python community (hopefully 3.X and not 2.7).

Collapse
 
nonamepro0 profile image
No Name Pro

Thank you for your contribution. Well yes, I am using the latest version 3.8. 😊