pawandeep

pawandeep

21 Articles Published

Articles by pawandeep

21 articles

How to install Tkinter in Python?

pawandeep
pawandeep
Updated on 31-May-2024 648K+ Views

Tkinter is a standard library in Python which is used for GUI application. Tkinter has various controls which are used to build a GUI-based application.To install Tkinter, we need Python pre-installed. Tkinter actually comes along when we install Python. While installing Python, we need to check the td/tk and IDLE checkbox. This will install the tkinter and we need not install it separately.However, if we missed installing Tkinter while installing Python, we can do it later using the pip command.Step 1 − Make sure Python and pip is preinstalled on your systemType the following commands in command propmt to check ...

Read More

How to install Python in Windows?

pawandeep
pawandeep
Updated on 26-Feb-2024 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

How to clear Python shell?

pawandeep
pawandeep
Updated on 31-Oct-2023 27K+ Views

Python provides a python shell which is used to execute a single Python command and display the result. It is also called REPL. REPL stands for Read, Evaluate, Print and Loop. The command is read, then evaluated, afterwards the result is printed and looped back to read the next command.Sometimes after executing so many commands and getting haphazard output or having executed some unnecessary commands, we may need to clear the python shell. If the shell is not cleared, we will need to scroll the screen too many times which is inefficient. Thus, it is required to clear the python ...

Read More

How to create a DataFrame in Python?

pawandeep
pawandeep
Updated on 25-Aug-2023 35K+ Views

Dataframe is a 2D data structure. Dataframe is used to represent data in tabular format in rows and columns. It is like a spreadsheet or a sql table. Dataframe is a Pandas object.To create a dataframe, we need to import pandas. Dataframe can be created using dataframe() function. The dataframe() takes one or two parameters. The first one is the data which is to be filled in the dataframe table. The data can be in form of list of lists or dictionary of lists. In case of list of lists data, the second parameter is the columns name.Create dataframe from ...

Read More

How to declare a variable in Python?

pawandeep
pawandeep
Updated on 23-Aug-2023 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

How to compare two lists in Python?

pawandeep
pawandeep
Updated on 23-Aug-2023 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

How to print in same line in Python?

pawandeep
pawandeep
Updated on 22-Aug-2023 123K+ Views

The print() method in Python automatically prints in the next line each time. The print() method by default takes the pointer to the next line.Example Live Demofor i in range(5):    print(i)Output0 1 2 3 4Modify print() method to print on the same lineThe print method takes an extra parameter end=" " to keep the pointer on the same line.The end parameter can take certain values such as a space or some sign in the double quotes to separate the elements printed in the same line.Syntaxprint("..." , end=" ")Print on same line with space between each elementThe end=” “ is used ...

Read More

Which is the fastest implementation of Python

pawandeep
pawandeep
Updated on 11-Jun-2021 988 Views

Python has many active implementations. We will be addressing its different implementations and know which is the fastest implementation.Different implementations of Python −IronPython − This is the Python implementation which runs on .NET framework. This implementation is written in C#. It uses .net virtual machine for running. IronPython can use the python libraries and .net framework libraries.Jython − Jython is the implementation of Python which runs on the Java Platform. The jython makes use of the java classes and libraries. The jythoncode is compiled into java byte code and it is run on Java Virtual Machine.PyPy − This is the implementation of Python ...

Read More

How to connect Database in Python?

pawandeep
pawandeep
Updated on 11-Jun-2021 4K+ Views

Most of the applications need to be integrated or connected with a database for performing certain relevant operations. The majority of projects require database connectivity to store certain data about the users. MySQL Database can be integrated with the Python applications.To connect MySQL database, we need to have it installed on our system. We need MySQL Connector to establish connection with the database. We can install MySql Connector using the following command.python –m pip install mysql-connector-pythonThis will install the MySQL Connector which is used to connect the python project or application to a database.Create a connectionFirst of all, it is ...

Read More

Palindrome in Python: How to check a number is palindrome?

pawandeep
pawandeep
Updated on 11-Mar-2021 733 Views

What is a palindrome?A palindrome is a string that is the same when read from left to right or from right to left. In other words, a palindrome string is the one whose reverse is equal to the original string.For example, civic, madam are palindromes.Cat is not a palindrome. Since its reverse is tac, which is not equal to the original string (cat).Write a program to find whether the input string is a palindrome or not.Method 1 - Find Reverse of the stringThe main thing required in the program is to find the reverse of the string.The reverse can be ...

Read More
Showing 1–10 of 21 articles
« Prev 1 2 3 Next »
Advertisements