DEV Community

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

Posted on β€’ Originally published at blog.nonamepro.ga

4 2

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.

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (2)

Collapse
 
nonamepro0 profile image
No Name Pro β€’

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

Sentry image

See why 4M developers consider Sentry, β€œnot bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more