
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 10476 Articles for Python

68K+ Views
In Python, we need not declare a variable with some specific data type.Python has no command for declaring a variable. A variable is created when some value is assigned to it. The value assigned to a variable determines the data type of that variable.Thus, declaring a variable in Python is very simple.Just name the variableAssign the required value to itThe data type of the variable will be automatically determined from the value assigned, we need not define it explicitly.Declare an integer variableTo declare an integer variable −Name the variableAssign an integer value to itExample Live Demox=2 print(x) print(type(x))This is how you ... Read More

2K+ Views
A Dictionary in Python is a type of data structure.It consists of a collection of key-value pairs. Each key in the dictionary is unique. Each unique key in the dictionary is associated to its value. Thus, Dictionary holds key : value pairs.We will be discussing how to create a dictionary in Python.Create a DictionaryA dictionary in Python can be created by placing various key: value pairs inside curly braces .The key:value pairs are separated from each other using commas(, ). The values in the dictionary can be of any datatype and can be duplicated. However, the keys in the dictionary ... Read More

1K+ Views
Type conversion is at times needed when the user wants to convert one data type into another data type according to requirement.Python has in-built function str() to convert an integer to a string. We will be discussing various other methods in addition to this to convert int into string in Python.Using str()This is the most commonly used method to convert int into string in Python.The str() takes integer variable as a parameter and converts it into a string.Syntaxstr(integer variable)Example Live Demonum=2 print("Datatype before conversion", type(num)) num=str(num) print(num) print("Datatype after conversion", type(num))OutputDatatype before conversion 2 Datatype after conversion The type() function ... Read More

71K+ Views
The list in python is a collection of similar items. We may at times need to compare data items in the two lists to perform certain operations. We will discuss certain methods to compare two lists in python.Using list.sort() and == operatorThe list.sort() method sorts the two lists and the == operator compares the two lists item by item which means they have equal data items at equal positions. This checks if the list contains equal data item values but it does not take into account the order of elements in the list. This means that the list [1, 2, ... Read More

2K+ Views
There may be some situations, where we need to convert a list into a string. We will discuss different methods to do the same.IterationIterate through the list and append the elements to the string to convert list into a string. We will use for-in loop to iterate through the list elements.Example Live Demolist1=["Welcome", "To", "Tutorials", "Point"] string1="" for i in list1: string1=string1+i string2="" for i in list1: string2=string2+i+" " print(string1) print(string2)OutputWelcomeToTutorialsPoint Welcome To Tutorials PointUsing .join() methodThe list will be passed as a parameter inside the join method.Example Live Demolist1=["Welcome", "To", "Tutorials", "Point"] string1="" print(string1.join(list1)) string2=" " print(string2.join(list1))OutputWelcomeToTutorialsPoint Welcome To ... Read More

9K+ Views
After writing the code, we need to run the code to execute and obtain the output. On running the program, we can check whether the code is written is correct and produces the desired output.Running a python program is quite an easy task.Run on IDLETo run a python program on IDLE, follow the given steps −Write the python code and save it.To run the program, go to Run > Run Module or simply click F5.Run on Command LineThe python script file is saved with ‘.py’ extension. After saving the python script, we can run it from the Command Line. In ... Read More

1K+ Views
Python has no in-built function to reverse a string. Thus, we need to implement our own logic to reverse a string.We will reverse a string using different methods.Using FOR LoopThe idea behind this method is to use a reverse loop starting from the last index of the string to the 0th index. At each iteration, we will be adding characters of the string to hold the reversed string at the end of the iterations.Let’s look on the general procedure we will be following −a:=new stringloop from last index of string to 0th index and decrement by 1 a=a+character at the ... Read More

207K+ Views
Python is a widely used high-level programming language. To write and execute code in python, we first need to install Python on our system.Installing Python on Windows takes a series of few easy steps.Step 1 − Select Version of Python to InstallPython has various versions available with differences between the syntax and working of different versions of the language. We need to choose the version which we want to use or need. There are different versions of Python 2 and Python 3 available.Step 2 − Download Python Executable InstallerOn the web browser, in the official site of python (www.python.org), move ... Read More

3K+ Views
In this article, we will create a GUI-based dictionary using PyDictionary and Tkinter Module.PyDictionary is a Python Module that helps to get meaning translations, antonyms and synonyms of words. It uses WordNet for getting meanings, Google for translations, and synonym.com for getting synonyms and antonyms. PyDictionary uses BeautifulSoup, Requests module as the dependencies.In order to create the application, we will first install these modules in our environment using pip install PyDictionaryAfter installing, we will create a tkinter frame and some other element.Example# Import Required Librares from tkinter import * from PyDictionary import PyDictionary # Create instances and objests dictionary ... Read More

427 Views
In this article, we will create a GUI-based window resizer control panel that will have a pane to resize the window by its height or width.In order to create the application, we will first create a slider that will help to resize the window size. The sliders are available in the ttk library of tkinter. We will import “ttk” first. Then, we will launch a new window which needs to be resized.Let us first import all the required libraries in the notebook and design the control bars using sliders.Example# Import the required Libraries from tkinter import * from tkinter import ... Read More