Python – Page 11 – POFTUT

Category: Python

0

Random Number Generator In Python

Python is practical language which provides different functions in practical way. Random number are generally used in security related issues but there are other areas too. In this post we will look different random number generation examples about python. Generate Random Number Between 0 and 1 Python provides a library named random by default. This library is used to provide different type of random functions according to given parameters. We will...

0

Dictionary In Python Tutorial With Examples

Dictionaries is complex data structures those hold information about different type and related information. Dictionaries also called associative memories or associative arrays in different languages. Dictionaries generally format in key and value pair. Keys are used to label and  search and find values. Create Dictionary As we say before we will provide key and value pair. In this example we will create a phone book. The name of the phonebook is pb and have some...

0

Different Ways To Use Python Print Function

Python is very expressive language which provides a lot of different output types and extensions. Printf is one of the most used function to print output. In this tutorial we will look different usage types of printf Print String Value This is the simplest usage form of the printf function. We will create a variable named a which holds string “Hi Poftut” . We will print this string by providing in to print function.

...

0

Python Date Time Operations Tutorial with Examples

Python datetime library provides a lot of different functionalities to operate with date and time values. Python datetime library can be found later versions from 2.3 . There is datetime library related libraries liketime and calender if you are interested specific issue. Time Time values are represented with time class. Time class gives the ability to hold values like hour, minute, second, microsecond. Time values also holds time zone information....

1

How To Convert Python String To Int?

Python have different variable types. Integer and string types are most used types. And conversation between them is required most of time. In this post we will look howto convert string to int? String is character array like text data. Following examples are all string

All of the above definitions are string but they hold different or numeric characters. Integer is base type for python. Integer is actually an...

0

Python For Loop Tutorial with Examples

Python programming language provides loops with for statement. It is similar to the most of the main stream programming languages like C, C++, Java or C# . We will look to the for loop Python examples. for loop mainly used to iterate over specified list or array. For Loop Python Syntax Syntax for python for loop is like below.

Simple and Basic For Loop Here is a simple for loop...

0

Python Command Line Arguments with sys.argv

Python scripts can be run different ways. Python interpreter can be used to file python scripts but it is not so practical. Also scripts are not saved. After interpreter is closed or written code will be lost. Most popular usage to write and run python scripts is creating python script file and running it. Passing parameters or options to the script is very useful. There is two popular way to...

1

How To Sort Python Dictionary By Value?

We have a dictionary which is read from a file. One field is string other field is number. String fields are unique and used as keys. Sorting by keys is easy but how can we sort them by values Our Dictionary We have the following dictionary which is consist of string and numbers.

By the way we are using python interpreter to make things more interactive and easy Sort...

0

How To Count Words In A Sentence In Python?

I want to send my text to the python application as argument. The application will return the count of words in the text. Here is the basic but useful sample python application. Python Script We have following python script which is named sentence_word_count.py . It gets sentence as argument and split it according to spaces. Uses len() function in order to count elements in the given list.

Run Python...

0

How To Install Numpy For Linux?

Python is modern, interpreted language used various areas. One area of python is big data and graphics. Python has a lot of 3 party libraries to draw graphics. Today I needed graphics library named Numpy. Numpy can be installed from different sources. But using pip is one way to install most up-to-date version. Install Python Development Libraries Python libraries are compiled after downloaded from pip. So we will install python...

Enjoy this blog? Please spread the word :)