- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 34483 Articles for Programming
3K+ Views
Given a string, our task is to check weather this string is palindrome or not.AlgorithmStep1: Enter string as an input. Step2: Using string slicing we reverse the string and compare it back to the original string. Step3: Then display the result.Example codemy_string=input("Enter string:") if(my_string==my_string[::-1]): print("The string is a palindrome") else: print("The string isn't a palindrome")OutputEnter string:madam The string is a palindrome Enter string:python The string isn't a palindrome
41K+ Views
Turtle is a special feature of Python. Using Turtle, we can easily draw in a drawing board.First, we import the turtle module. Then create a window, we create a turtle object, and using the turtle() method we can draw on the drawing board. Some turtle method METHOD PARAMETER DESCRIPTION Turtle() None It creates and returns a new turtle object forward() amount It moves the turtle forward by the specified amount backward() amount It moves the turtle backward by the specified amount right() angle It turns the turtle clockwise ... Read More
3K+ Views
In Python, Timer is a subclass of Thread class. Calling the start() method, the timer starts. Timer objects are used to create some actions which are bounded by the time period. Using timer object create some threads that carries out some actions. The Timer is stopped using the cancel() method. How to create a Timer object Following is how you can create a Timer object in Python − threading.Timer(interval, function, args = None, kwargs = None) Starting a Timer The timer.start() is used for start the timer. Here’s an example − Example import threading # All the text displays ... Read More
1K+ Views
In this example, we will see how to find the N largest elements from a List. The list is the most versatile datatype available in Python, which can be written as a list of comma-separated values (items) between square brackets. Important thing about a list is that the items in a list need not be of the same type Let’s say the following is the input list − [25, 18, 29, 87, 45, 67, 98, 5, 59] The following is the output displaying the N largest element from the list. Here, N = 3 − [98, 87, 67] ... Read More
4K+ Views
In this article, we will learn how to convert time from 12 to 24 hours format. Let’s say we have the following input date in 12-hour format − 10:25:30 PM The following is the output in 24-hour format − 22:25:30 Convert current time from 12 hour to 24 hour format To convert time from 12 hour to 24 hour format, here’s the code − Example import datetime def timeconvert(str1): if str1[-2:] == "AM" and str1[:2] == "12": return "00" + str1[2:-2] elif str1[-2:] == "AM": return str1[:-2] elif str1[-2:] == "PM" and str1[:2] == "12": return str1[:-2] ... Read More
495 Views
The full form of OpenCv is Open Source Computer Vision, using this library we can perform different operations on images, videos.Application areas of OpenCVFacial recognition systemMotion trackingArtificial neural networkDeep neural networkVideo streaming etc.For installing on Windows we can use this command linepip install opencv-pythonFor Linux −sudo apt-get install python-opencvTo complete our task we have to follow some steps −Step 1: We import OpenCv library named cv2. Step 2: Take a video as input data. Step 3: First we break the video into a number of frames and store all these frames in a list. Step 4: When we are getting ... Read More
5K+ Views
Python provides openpyxl module for operating with Excel files. How to create Excel files, how to write, read etc. can be implemented by this module. For installing openpyxl module, we can write this command in command prompt pip install openpyxl If we want to give a sheet title name Example code import openpyxl my_wb = openpyxl.Workbook() my_sheet = my_wb.active my_sheet_title = my_sheet.title print("My sheet title: " + my_sheet_title) Output My sheet title:Sheet To change Title Name Example code import openpyxl my_wb = openpyxl.Workbook() my_sheet = my_wb.active my_sheet.title = "My New Sheet" print("sheet name ... Read More
244 Views
In computer science Web scraping means extracting data from websites. Using this technique transform the unstructured data on the web into structured data.Most common web Scraping tools In Python3 are −Urllib2RequestsBeautifulSoupLxmlSeleniumMechanicalSoupUrllib2 − This tool is pre-installed with Python. This module is used for extracting the URL's. Using urlopen () function fetching the URL's using different protocols (FTP, HTTPetc.).Example codefrom urllib.request import urlopen my_html = urlopen("https://www.tutorialspoint.com/") print(my_html.read())Outputb'\r \r
438 Views
Given a string, our task is to generate some strings using the random combination of characters, special characters, numbers etc.ExampleInput PP Output AK AK . . . . .AlgorithmStep 1: Input a string. Step2: Here we store all possible combination of lowercase, uppercase and special characters in a variable. Step3: Use two loops and use random function. From this, we can get all the possible combinations of characters, symbols. Step4: At the end display same string which is same as an input string and it matches each random string with given input string. Step5: If both index values are same ... Read More
623 Views
Neural networks are very important core of deep learning; it has many practical applications in many different areas. Now a days these networks are used for image classification, speech recognition, object detection etc.Let’s do understand what is this and how does it work?This network has different components. They are as follows −An input layer, xAn arbitrary amount of hidden layersAn output layer, ŷA set of weights and biases between each layer which is defined by W and bNext is a choice of activation function for each hidden layer, σ.In this diagram 2-layer Neural Network is presented (the input layer is ... Read More