Articles by "python"
Showing posts with label python. Show all posts
PyCharm is an Integrated Development Environment (IDE) specially used for Python programming language. It is cross-platform available for Linux, Mac and Windows, and developed by JetBrains and offers two versions community edition and professional edition. It provides code analysis, a graphical debugger, an integrated unit tester, integration with version control systems (VCSes), and supports web development with Django.
The Community Edition is released under the Apache License, and the Professional Edition released under a proprietary license - this has extra features. Both editions let you write neat and maintainable code while the IDE helps you keep quality under control with PEP8 checks, testing assistance, smart refactorings, and a host of inspections. PyCharm is designed by programmers, for programmers, to provide all the tools you need for productive Python development.

Features:
  • Coding Assistance and Analysis, with code completion, syntax and error highlighting, linter integration, and quick fixes
  • Project and Code Navigation: specialized project views, file structure views and quick jumping between files, classes, methods and usages
  • Python Refactoring: including rename, extract method, introduce variable, introduce constant, pull up, push down and others
  • Support for web frameworks: Django, web2py and Flask
  • Integrated Python Debugger
  • Integrated Unit Testing, with line-by-line code coverage
  • Google App Engine Python Development
  • Version Control Integration: unified user interface for Mercurial, Git, Subversion, Perforce and CVS with changelists and merge
  • PyCharm 50+ IDE plugins of different nature, including support for additional VCS

Install via Snap package

Available for Ubuntu 18.10 Cosmic/18.04 Bionic/16.04 Xenial/Linux Mint 19.x/18/and other related Ubuntu derivatives
To install PyCharm Community and Professional edition in Ubuntu/Linux Mint open Terminal (Press Ctrl+Alt+T) and copy the following commands in the terminal:


For Pycharm Professional or Educational use these command:

Install via PPA

Available for Ubuntu 18.10 Cosmic/18.04 Bionic/16.04 Xenial/14.04 Trusty/Linux Mint 19.x/18/17/and other related Ubuntu derivatives
To install PyCharm Community and Professional edition in Ubuntu/Linux Mint open Terminal (Press Ctrl+Alt+T) and copy the following commands in the terminal:


For Pycharm Professional run this command:
That's it
In the part one of this series, we showed you how to use variables in Python 3. In this tutorial, we are going to work with Strings and Numbers.
Note: Before you start, make sure you run each given code to understand that how things work!

Strings

String is a data type in programming language, strings in Python are very simple at initial glance but we can use them in many ways.
A string is a sequence of letters, numbers or symbols enclosed in single or double quotation marks. String are immutable data type that means we can't change it once defined. Strings does not require to be defined in advance.

String defined using double quotation marks:
greeting = "Hello There!"

String defined using single quotes:
hint = 'Using single quotes'

Using apostrophe in a string. Well, there are two ways of doing it:
saying = "If you can't help yourself then nobody will."
The other way of using apostrophe with escape character, if you still want to use single quotes:
saying = 'If you can\'t help yourself then nobody will.'

Combining and concatenating strings using addition operator, in simple words you can join multiple strings:
example_concatenation_string = "First part" + ' and ' + "last part"
print("Lap" + 'top')
print("Another: " + example_concatenation_string)

Multiplying a string, you will find it useful later:
example_multiply = "Hey There!"*5

Know the length of the string using len function:
print(len("Hey There!"))
length_of_string = "This is a string."
print(len(length_of_string))

Strings can be written on multiple lines:
quote = """A person who never made a
 mistake never tried 
 anything new."""
print(quote)

Find out if the sub-string is present in a string:
quote = "A person who never made a mistake never tried anything new."
print("mistake" in quote)

print("learning" in "You are learning Python 3.")

Special characters in strings:
We can do formatting in strings using special characters, for instance we need line break, tabs or other formatting. These formatting can be done in a string using special character called escape.

Line break in a string:
quote = "Albert Einstien said:\nA person who never made a mistake never tried anything new."
print(quote)

Tab in a string:
print("Languages:\n\tC++\n\tPython\n\tJava\n\tC")

Printing a backslash character:
print("Languages:\\C++\\Python\\Java\\C")

Making string omit the recognition of escape character:
print(r"Omitting these escape characters \t and \n.")

String formatting
Convert numerical values to string using str function:
print(str(1))
print(str(33.33))
print(str(987+11j))

Use numbers in a string:
print("He is " + str(23) + " years old.")

Strings case formatting:
The string case formatting is very useful, for instance you ask user to enter the username and it has to be unique for each user. In such case, you can collect the input from user and store it in lowercase then compare it with all the usernames in your list and if it is already taken then you can notify the user, if not you allow user to create the username.
The first one is title case formatting, it is useful for scenarios like: person or place name and so on.
name = 'albert einstein'
print(name.title())

To convert string to lower case:
name = 'ALBERT EINSTEIN'
print(name.lower())

Use this method to change case to upper:
name = 'albert einstein'
print(name.upper())
We will see string formatting in more detail in upcoming articles.

Numbers

Numbers are important data type and used in every program, for example: score in games, represent data, store information in web applications and so on. Numbers without decimal considered as integers in Python.
Python also supports the order of operations, let us use multiple operations in one expression.

Use of add (+), subtract (-), multiply (*) and divide (/) sign in the Python:
print(10+2)
print(12-2)
print(6*2)
print(24/2)

Exponents use two multiplication operators in Python:
print(2**2)
print(3**9)

Order of operation in a single expression:
print(5-1 * 2)
print((5-1) * 2)

Floats, you can use floats without worrying about how they will behave:
print(0.1 + 0.8)
print(1.1 * 2.99)

Example of a square root in Python:
print(100**0.5)

That's all folks for this lesson! Hopefully these things will help you.

Python: A fairly simple, readable, interpreted, general-purpose and high-level programming language.
We are starting a tutorial on Python 3 programming language, you can call it web-based-Bootcamp. In this series, 'Learn Python 3' the aim is to teach you Python 3 as quickly as possible so you can start building programs. 'Learn Python 3' course(Tutorial) is for people of any age, doesn't matter if you haven't programmed before in Python or new to programming. We shall start from very basics of programming and by time we will be learning advance stuff and deep dive into Python.
Currently, Python has two versions available 2 and 3. Many companies are still using Python 2 and many useful software written in Python 2 that's why it's being used widely, on the other hand, people are adopting Python 3 and porting their Python 2 software to Python 3. In this tutorial series, we will use latest version of Python 3 and it's very easy to learn Python 2 after you acquire knowledge of Python 3. There are some syntax differences in both versions. With time, we'll construct tutorial as per user needs and make it better for all of you.

You'll learn in this tutorial:
  • Traditional 'Hello world' program
  • Variables

First of all you need to setup Python on your system. If you are using Linux or Mac then your OS have it installed already, if you want to get latest version of Python then follow this guide for Linux. For Mac and Windows check official website of Python.

Note: Before you start, make sure you run each given code to understand that how things work!

Your first Python program

If you are a new to programming then today you are going to write very first program. It is traditional and almost every programmer has done it regardless of programming language.
In Python it is very very simple to do "Hello World!" program. You just need to write one line. There are numerous ways to run Python program, we keep it simple for now. In Linux, just type the version of Python installed on your system for example: python3.5.
If you don't want to install Python or don't know how to install it then you can use online Python console called "Relp.it".

We are going to do it other way by creating a file and write our code in it. Then we go to Terminal and run file with Python3. You can see this way in the following screenshot.
Once you are ready with Python console then type the following code in it and hit enter to run it.
print("Hello World!")
You will see the output like this:

Congratulations, on writing your first program in Python. Lets see what we are doing here:
print( ) => it prints message to the screen, or other output device. The message can be anything string or object.
"Hello World!" => It is a message between double quotes, it is called string. We can surround string with double " " quotes or single ' ' quotes, both quotation marks functions same for example 'Hello World!'.

Variables in Python

In programming variables used to store data or we can call them containers where we put something in them in-order to access stored data later. Every variable hold certain value(s) and variables are mutable that means we can change variable's value at any time in our program.
Variables can store all sort of data like: numbers, strings, booleans and objects.

There are some rules when defining a variable in Python programming language:
  • Variable names should be descriptive, for example: my_message. Avoid using very short variables such as my_m, you will scratch your head later understanding your program.
  • Be careful using lowercase letter 'l' and uppercase letter 'O' because they can be mixed with 1 and 0.
  • Don't use Python reserved keywords and function names.
  • Variables can only contain letters, numbers and underscores.
  • Variable can't start with numbers.
  • Spaces are not permitted in variables.

Lets see how to create variables:

We will modify our first 'Hello World' program to show you, how variables work!

message = "Hello World!"
print(message)

First line of the program, the string 'Hello World!' is stored in variable called 'message'. We can have give any name to the variable.
Then we are using print function to output our message on the screen. Also, we can defined variable 'message' as many times as we want in our program.
We can reassign a new value to 'message' in the same program and there won't be any issue. Lets see an example:
message = "Hello World!"
print(message)

message = 'We are defining another variable'
print(message)


Another example with numbers:
number = 100
print(number)

Assign variable to another variable
You can also assign a variable which has a value to new variable. See following example for more clarification:
number = 100
print(number)

new_number_variable = number
print(new_number_variable)
In this example, we assigned value of variable 'number' to new variable called 'new_number_variable'. Now we can use 'new_number_variable' to print the same value.

Compact assignments
Python allows us to make multiple assignment in just one line, it is useful when you want to make your program compact but make less readable/complex:
varX, varY, varZ = 'Hello', 50, '1 Penny'
print(varX)
print(varY)
print(varZ)

Multiple assignments
We can assign same value to multiple variables. In the following example, all variables hold the same value, you can print each variable to check its value:
my_number = number = last_number = first_number = 200
print(my_number)
print(number)
print(first_number)
print(last_number)

That's it for today.
Stay tuned for more tutorials on Python 3 programming language! Happy coding.
Python is a high-level interpreted programming language. The first version of Python was released in 1991. In this article we are not going to discuss what kind of language it is or how you can use it but to show you how you can install it on your Linux system.
If you are a beginner in Python programming or undergoing Python Course then you want to run some program which requires latest Python version then you are on the right page, we will show you how you can install latest Python version on your Linux(Debian/Ubuntu/Linux Mint/other distributions), currently Python reached at 3.7.x version. Making other Python version default in Linux can make Python applications and desktop components unusable which use certain version of Python. It is better not to set any Python as default in Linux (PS: You can set as default, if you know how to fix if something goes wrong). It is easy to revert back any Python version. Lets start...

Python 3.7.x

We are going to show you two ways to install Python 3.7.x, the PPA method is for Ubuntu/Linux Mint/and Ubuntu dervatives. The second method is universal that means you can install Python 3.7.x on any Linux distribution (Fedora, CentOS, RedHat, openSUSE, Manjaro, ArchLinux etc.)

Install Python 3.7.x using PPA in Ubuntu/Linux Mint

PPA is fairly simple way to install Python:

Available for Ubuntu 18.04 Bionic/16.04 Xenial/14.04 Trusty/Linux Mint 19/18/17/and other related Ubuntu derivatives
To install Python 3.7.x in Ubuntu/Linux Mint open Terminal (Press Ctrl+Alt+T) and copy the following commands in the Terminal:


If you want to install Python 3.6 then use this command(Ubuntu 16.04/14.04/Linux Mint 18/17):

For Python 3.5 use this command (Ubuntu 18.04/14.04/Linux Mint 19/17):

For Python 3.4 use this command (Ubuntu 18.04/16.04/Linux Mint 19/18):

For Python 3.3 use this command (Ubuntu 18.04/16.04/14.04/Linux Mint 19/18/17):


Install Python 3.7.x using source

Using this method you can install Python 3.7.1 in any Linux distribution (Debian, Fedora, CentOS, Manjaro, ArchLinux, openSUSE, Ubuntu etc.)


That's it

The Official Samba-3 HOWTO and Reference Guide

Fully Updated to Reflect Major Improvements and Configuration Changes in Samba-3.0.11 through 3.0.20+!
Use this book to go far beyond basic deployment, leveraging all of Samba's components, from directory services to remote administration. Use it to find practical optimization techniques for any environment, from the workgroup to the enterprise. Use it to find detailed guidance and best practices for troubleshooting and problem solving. And, if your background is in Windows networking, use this book to get up to speed rapidly with Samba network administration in Linux/UNIX environments.

Dive Into Python

Python from novice to pro, Whether you're an experienced programmer looking to get into Python or grizzled Python veteran who remembers the days when you had to import the string module, Dive Into Python is your 'desert island' Python book.

Python is a widely used general-purpose, high-level programming language. Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than would be possible in languages such as C. The language provides constructs intended to enable clear programs on both a small and large scale.
Python supports multiple programming paradigms, including object-oriented, imperative and functional programming or procedural styles. It features a dynamic type system and automatic memory management and has a large and comprehensive standard library.
Like other dynamic languages, Python is often used as a scripting language, but is also used in a wide range of non-scripting contexts. Using third-party tools, such as Py2exe, or Pyinstaller, Python code can be packaged into standalone executable programs. Python interpreters are available for many operating systems.

We just promote free stuff, for external sites read our privacy policy.