Skip to main content

Posts

Codechef ATM Problem Solve in Python

  Codechef --- ATM Problem Solve in Python Pooja would like to withdraw X $US from an ATM . The cash machine will only accept the transaction if X is a multiple of 5, and Pooja's account balance has enough cash to perform the withdrawal transaction (including bank charges). For each successful withdrawal, the bank charges 0.50 $US. Calculate Pooja's account balance after an attempted transaction. Ex. - Positive integer 0 < X <= 2000 - the amount of cash which Pooja wishes to withdraw. Nonnegative number 0<= Y <= 2000 with two digits of precision - Pooja's initial account balance. Example - Successful Transaction Input: 30 120.00 Output: 89.50 Code :-- total_amount = 120 #int(input("Enter your total avalable account balence:-- ")) cash_withdr = 30 #int(input("How much money do you want :-- ")) check_amount = cash_withdr * 4 if check_amount <= total_amount: now_balence = float(((total_amount - cash_withdr) - 0.50)) print(&

10 Reasons Why Python is so much in Demand?

  10 Reasons Why Python is so much in Demand? Python is one of the most prevalent programming languages. It is highly user-friendly and an open-source language. Python is not only growing its popularity but also enhancing its applications in almost every field.  Python is one of the most prevalent programming languages. It is highly user-friendly and an open-source language. Python is not only growing its popularity but also enhancing its applications in almost every field. 1. Python has Simple Syntax Python language is very simple and easy to handle. It has a very easy and user-friendly syntax. It is not too difficult to code in Python because of its syntax. Its syntax is somewhat similar to that of the English Language. It does not have complicated syntax as other languages. You can code in Python even without having in-depth knowledge of Python . It does not even require any braces; it just works on indentation. 2. Python has an Abundance of Libraries and Frameworks It consists of

Python Libraries a Data Scientist must know

  Top 21 Python Libraries a Data Scientist must know Python is an   abundant source   of   libraries . A Python library is a gathering of  functions  that assist one to  perform many actions . It has  myriad inbuilt   libraries . Python contains ample libraries for  data science . This tutorial covers  Python libraries  for a data scientist. 1. Data Cleaning and Data Manipulation Pandas NumPy Spacy SciPy 2. Data Gathering Beautiful Soap Scrapy Selenium 3. Data Visualisation Matplotlib Seaborn Bokeh Plotly 4. Data Modelling Scikit-Learn PyTorch TensorFlow Theano 5. Image Processing Scikit-Image Pillow OpenCV 6. Audio Processing pyAudioAnalysis Librosa Madmom

why we use Numpy in python

  why we use NumPy in python NumPy  is a general-purpose array-processing package. It provides a high-performance multidimensional array object and tools for working with these arrays. It is the fundamental package for scientific computing with  Python .  A powerful N-dimensional array object. Syntex:-   import  numpy arr = numpy.array([ 1 ,  2 ,  3 ,  4 ,  5 ]) print (arr)     Output:-   [1 2 3 4 5] NumPy  is a basic level external library in Python  used  for complex mathematical operations.  NumPy  overcomes slower executions with the  use  of multi-dimensional array objects. It has built-in functions for manipulating arrays. We can convert different algorithms to can into functions for applying on arrays.   NumPy  arrays are faster and more compact than Python lists. An array consumes less memory and is convenient to  use .  NumPy uses  much less memory to store data and it provides a mechanism of specifying the data types.

Elon Musk

  Elon Musk Elon Musk   (born June 28, 1971,  Pretoria , South Africa), South African-born American  entrepreneur  who cofounded the electronic-payment firm  PayPal  and formed  SpaceX , maker of launch vehicles and spacecraft. He was also one of the first significant investors in, as well as chief executive officer of, the  electric car  manufacturer Tesla. Early life Musk was born to a South African father and a Canadian mother. He displayed an early talent for computers and entrepreneurship. At age 12 he created a video game and sold it to a computer magazine. In 1988, after obtaining a Canadian passport, Musk left South Africa because he was unwilling to support apartheid through compulsory military service and because he sought the greater economic opportunities available in the United States. PayPal and SpaceX Musk attended Queen’s University in Kingston, Ontario, and in 1992 he transferred to the University of Pennsylvania, Philadelphia, where he received bachelor’s degrees in p

Linear Search

 Linear Search Linear search is a very simple search algorithm. In this type of search, a sequential search is made over all items one by one. Every item is checked and if a match is found then that particular item is returned, otherwise the search continues till the end of the data collection. Linear Search Program def linear_search(list,target):     for i in range(0,len(list)):         if list[i] == target:             return i     return None def verify(index):     if index is not None:         print("Target found at index: ",index)     else:         print("Target not found in index")          numbers = [1,2,3,4,5,6,7,8,9,10]  result=linear_search(numbers,7) verify(result) Output:-    Target found at index: 6

Difference between loc() and iloc() in Pandas DataFrame

  Difference between loc() and iloc() in Pandas DataFrame Pandas library of python is very useful for the manipulation of mathematical data and is widely used in the field of machine learning. It comprises many methods for its proper functioning.  loc()  and  iloc()  are one of those methods. These are used in slicing data from the Pandas DataFrame. They help in the convenient selection of data from the DataFrame. They are used in filtering the data according to some conditions. The working of both of these methods is explained in the sample dataset of cars. loc()  :  loc()  is label-based data selecting method which means that we have to pass the name of the row or column which we want to select. This method includes the last element of the range passed in it, unlike  iloc() .  loc()   can accept the boolean data unlike  iloc()  .  iloc() :  iloc( )  is an indexed-based selecting method which means that we have to pass integer index in the method to select a specific row/column. This