• Register

Recent posts tagged python

10 0 2 min.
Installing Python on Windows 1. Download Python, 2.Install  We verify that it was installed correctly on disk C:  We launch a console to check: II. Install Python Modules with PIP Final part of the tutorial, since we would need to see ...
posted Jul 3 amna 113,233 points
7 2 2 min.
As I anticipated in the introduction, range is a data type that represents an immutable sequence of numbers.To create an object of type range, two constructors can be used:range(fin): Creates a number sequence from 0to fin - ...
posted Jul 3 amna 113,233 points
3 0 5 min.
TypeError Traceback (most recent call last) <ipython-input-15-c6891cd94aee> in <module> 185 186 if __name__ == "__main__": --> 187 main() 188 189 <ipython-input-15-c6...
posted Jul 2 A.H.M 106 points
5 0 2 min.
The if/ elif/ structure   elseis a common way to control the flow of a program, allowing you to execute specific blocks of code based on the value of some data.If statementIf the condition that follows the keyword if&nbs...
posted Jul 1 amna 113,233 points
5 2 2 min.
The most common way to repeat a specific task or operation N times is by using the loop forin programming.We can iterate the lines of code N times using the loop forwith the function range()in Python. The function range(start...
posted Jul 1 amna 113,233 points
9 0 2 min.
In the event that you get the accompanying blunder while doing the git pull on the worker : blunder: Your nearby changes to the accompanying records would be overwritten by blend: filename.extension¬†Kindly submit your progressions or reserv...
posted Jun 30 amna 113,233 points
7 0 2 min.
Mixing dtypes makes this conversion more complicated than usual. The answer in the end, copying the fields into a target array has the combination of speed and generality.Convert Structured Array to Regular NumPy Array - Suggested as duplicate, ...
posted Jun 30 amna 113,233 points
2 0 1 min.
A string in Python is a series sequence of characters. It is a derived datatype. Strings are immutable so that after defined once, they can't be changed. Many Python methods, which includes replace() , join() , or split() adjust strings.Counting ...
posted Jun 30 mhfaisal 415 points
9 0 3 min.
Format: time .strftime (format)Example:>>> import time >>> time.strftime ("% H:% M:% S")¬†# 24 hour format 20:08:40 >>> import time >>> time.strftime ("% I:% M:% S")¬†# 12 hour format 08:08:40Print the cur...
posted Jun 30 amna 113,233 points
7 0 4 min.
In Computer Science, the "output" of a program is the data that the program provides to the outside. Although in the early days of computing the most common output was a printer, for many years the most common output device has been th...
posted Jun 29 amna 113,233 points
9 0 2 min.
Because Python is an interpreted language, compiling it can mean many things, including compiling to byte code or transforming into another language. When you learn how to take Python code and compile it into an executable for Windows platforms,...
posted Jun 29 amna 113,233 points
8 0 2 min.
Take for example the following file iso_8859-1.txt . To read this file we can then do like this:f = open('iso_8859-1.txt', 'r') f.closed Read the whole file If you want to read the whole file, just add the f.read () command: f = open('iso_8859-1.tx...
posted Jun 29 amna 113,233 points
7 0 3 min.
os is a built-in package available in both Python 2 and Python 3.We can use remove()and unlink()from the module osto delete files using Python. Both functions are similar in their action. Both take the path of the file t...
posted Jun 29 amna 113,233 points
0 2 2 min.
Python lists and dictionaries are the most commonly used collections in Python, but they are thought of like the same things by new or inexperienced programmers. Python lists and dictionaries are two different constructs and in this article, we are g...
posted Jun 28 Hafsa_Rao 28,528 points
1 1 1 min.
Difference between list and set in pythonA set is a collection which is unordered and unindexed, and doesnt allow duplicates. In Python, sets are written with curly brackets.# example of set newset1 = {"one", "two", "three", "four", "five", "six", "s...
posted Jun 28 offonime 468 points
2 1 2 min.
How to check if a number is odd in pythonThe odd numbers from 1 to 100 are: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89,...
posted Jun 28 offonime 468 points
11 0 1 min.
Deleting an element from a list in pythonExample 1#Deleting an element from a list in python #The remove() method removes the specified item thislist = ['A', 'B', 'C', 'D', 'E', 'F','G', 'H', 'I', 'K', 'L', 'M', 'N'] thislist.remove("A") print("T...
posted Jun 27 offonime 468 points
5 0 3 min.
As in other programming languages, a function is nothing more than a portion or block of reusable code that is responsible for carrying out a certain task.It is comfortable to work with functions, because it’s not necessary to rewrite...
posted Jun 27 amna 113,233 points
5 1 3 min.
While attempting an online quiz for programming in Python, a lot of people must have come across the following question:In Python, what is the input() feature best described as?Many people might have answered this question correctly but some mig...
posted Jun 26 Hafsa_Rao 28,528 points
6 1 1 min.
How to make a string all lowercase pythonExample 1# How to make a string all lowercase python string = "I WAS BORN BY THE RIVER, IN A LILL TENT" print(string.lower()) # string with numbers # all THE ALPHABETS WILL TURN TO LOWER CASE string = ...
posted Jun 26 offonime 468 points