Saturday, 2 May 2020

Last Stone Weight | Python

Code: class Solution: def lastStoneWeight(self, stones: List[int]) -> int: while(len(stones)>1): heaviest=max(stones); stones.remove(heaviest); heavier=max(stones); stones.remove(heavier); if(heaviest!=heavier): stones.append(heaviest-heavier); if(len(stones)==0): return 0; else: return stones[0];

Python for beginners: https://www.youtube.com/watch?v=egq7Z...

Telegram: https://t.me/clcoding_python https://www.facebook.com/pirawenpython/

Move Zeroes | Python

Code: class Solution: def moveZeroes(self, nums: List[int]) -> None: g=nums.count(0); i=0; while(i<g): nums.remove(0); nums.append(0); i=i+1;

Python for beginners: https://www.youtube.com/watch?v=egq7Z...

Telegram: https://t.me/clcoding_python https://www.facebook.com/pirawenpython/


Counting Elements | Python

Code :

class Solution: def countElements(self, arr: List[int]) -> int: output=0; for i in arr: if(i+1 in arr): output+=1; return output;
Python for beginners: https://www.youtube.com/watch?v=egq7Z..

Telegram: https://t.me/clcoding_python


Program to find whether a no is power of two or not | Python

Prerequisite: Data Type Conversion | Python | Castor Classes https://www.youtube.com/watch?v=z8yw6... Turn off the rightmost set bit | Python | Castor Classes https://www.youtube.com/watch?v=ol4VW... Relationship between binary representation of n & n-1 | Python | Castor Classes https://www.youtube.com/watch?v=iTxc9... Python for beginners: https://www.youtube.com/watch?v=egq7Z..

Telegram: https://t.me/clcoding_python

Escape Sequence in Python

Escape Sequence - 

Escape sequences are control character used to move the cursor and print characters such as ',".\ and so on.


















Friday, 1 May 2020

Python Input() Function

Input( )

Python provides us the facility to take input from user using Input( ) function. This function prompts the user to input a value.

For example :

Name = input("Enter Your Name");
print(Name);

Output will be the name as entered by the user.

Let us take the example again:

name = input("Enter Your Name:");
print("Welcome Mr.",name);

Here suppose the user enter the name as "xyz Kumar" so the variable name will contain xyz Kumar. In such case the output of the program will be:

Output      Welcome Mr. xyz Kumar


 Please note that the input( ) accepts the input only in string format. so, if any mathematical calculation is to be performed, we need to convert the input to integer format. for converting the input to integer format Python provide us a function called :

Program without using int( ) function :

a = input ("Enter 1st Number:");
b =  input("Enter 2nd Number:");
c = a+b;
print("Addition =",c);

In this case if the value of a & b as given by user is 5 & 6 respectively then the output will be 56. As 5 & 6 will be treated as string and not integer.

Program using int( ) function

a = int(input("Enter 1st Number:"));
b = int(input("Enter 2nd Number:"));
c=a+b;
print("Addition=",c);

 In this case if the value of a & b as given by user is 5 & 6 then output will be 11 as we have converted the input from string to integer format.



Thursday, 30 April 2020

Turn off the rightmost set bit | Python

Question: Write a program that unsets the rightmost set bit of an integer. Input: 12 Output: 8 Input: 7 Output: 6 Simple code: n=int(input()); print(n & (n-1)) Prerequisite: Data Type Conversion | Python | Castor Classes https://www.youtube.com/watch?v=z8yw6... Relationship between binary representation of n & n-1 | Python | Castor Classes https://www.youtube.com/watch?v=iTxc9... Python for beginners: https://www.youtube.com/watch?v=egq7Z..

Join: t.me/clcoding_python

Relationship between binary representation of n & n-1 | Python

Let's learn Python from basics.

Prerequisite:
Data Type Conversion | Python | Castor Classes
https://www.youtube.com/watch?v=z8yw67K8rC0 Python for beginners:
https://www.youtube.com/watch?v=nAWv9rGwGMQ&list=PLNhFkFk6qEgIq3lcbmxWIBFjEcq4lwRyk

Join: t.me/clcoding_python


Like us: https://www.facebook.com/pirawenpython/

Checking a number is Odd or Even using Bitwise Operators | Python

Prerequisite:
Bitwise Operation in Python | Castor Classes
https://www.youtube.com/watch?v=mqkBM9Nwy3k Python for beginners:
https://www.youtube.com/watch?v=nAWv9rGwGMQ&list=PLNhFkFk6qEgIq3lcbmxWIBFjEcq4lwRyk

Join: t.me/clcoding_python

#Code
e=10;
e%2==0

True

f=11;
f%2==0

False 

Like us: https://www.facebook.com/pirawenpython/

Tuple in Python | Part 2

Topics discussed in this video:
1)Accessing Elements of a Tuple
2)Creating New Tuples from Existing Tuples
3)Iterating Over Tuples
4)length of a Tuple
5)count how many times a specified value appears in a Tuple
6)find out the (first) index of a value in a Tuple
7)Checking if an Element Exists
8)Nested Tuples
9)Can we add or remove elements from a Tuple?

Prerequisite: Tuple in Python | Castor Classes https://www.youtube.com/watch?v=QJcs3... Python for beginners: https://www.youtube.com/watch?v=egq7Z...

String Immutability & count method | Python

Topics discussed: 1)count method 2)String immutability Python for beginners: https://www.youtube.com/watch?v=egq7Z...

x="Hello"
x.count('l')

2



Nested List & Matrix | List in Python | Part 7

Python for beginners: https://www.youtube.com/watch?v=egq7Z...

#Code to take Matrix input from user in Python
row=int(input("Enter the number of row:"));
column=int(input("Enter the number of columns:"));
l=[];
rs=[];
i=0;
j=0;
while i<row:
    while j<column:
        u=int(input());
        rs.append(u);
        j=j+1;
    l.append(rs);
    rs=[];
    j=0;
    i=i+1;
l



Wednesday, 29 April 2020

Converting an Input String into a Floating Point Number | Python

List Traversal using while loop & break statement | Python

Code: mylist=[]; l=int(input()); i=0; while(i<l): m=int(input()); mylist.append(m); i=i+1; i=0; g=0; while(i<=l-2): es=mylist[i]; ms=mylist[i+1]; if(es==ms and ms==4): g=g+1; break; i=i+1; if(g==0): print(False); else: print(True);


Python for beginners: https://www.youtube.com/watch?v=egq7Z...

Int to String ,Float to String ,String to Int & String to Float conversion | Python

Topics covered: 1)Integer to String conversion 2)Float to String conversion 3)String to Integer conversion 4)String to Float conversion 5)Different way to concatenate string Python for beginners: https://www.youtube.com/watch?v=egq7Z...


Telegram: https://t.me/clcoding_python https://www.facebook.com/pirawenpython/ https://www.facebook.com/groups/piraw...

Stacks and Queues using List | Data Structures | Python

Topics discussed: 1)Stack using List 2)Queue using List Prerequisite: List in Python | Part 1 | Castor Classes https://www.youtube.com/watch?v=P2ogQ... List in Python | Part 2 | Castor Classes https://www.youtube.com/watch?v=vNxxQ... Python for beginners: https://www.youtube.com/watch?v=egq7Z...

Tuesday, 28 April 2020

Tuple in Python

Topics covered: 1)Tuple 2)Packing 3)Unpacking 4)Swap two variables using Packing & Unpacking concept 5)Tuple with List Python for beginners: https://www.youtube.com/watch?v=egq7Z...



Web 🌐http://www.clcoding.com/ Telegram: https://t.me/clcoding_python https://www.facebook.com/pirawenpython/ https://www.facebook.com/groups/piraw..

Subtract the Product and Sum of Digits of an Integer | Python

Prerequisite:
Sum of Digits of a number | Python | Castor Classes
https://www.youtube.com/watch?v=IBK1-... Python for beginners:
https://www.youtube.com/watch?v=egq7Z...


Maximum 69 Number | Python

Check the problem statement here:
https://leetcode.com/problems/maximum... Prerequisite: List in Python | Part 6 | Castor Classes https://www.youtube.com/watch?v=kIpXn...

Factorials of large numbers | Python

In Python, value of an integer is not restricted by the number of bits and can expand to the limit of the available memory. Thus we never need any special arrangement for storing large numbers. Prerequisite: Loops in Python | Castor Classes https://www.youtube.com/watch?v=SZmbd


Monday, 27 April 2020

Advanced Guide to Python 3 Programming for Undergraduate Topics in Computer Science pdf

Advanced Guide to Python 3 Programming delves deeply into a host of subjects that you need to understand if you are to develop sophisticated real-world programs. Each topic is preceded by an introduction followed by more advanced topics, along with numerous examples, that take you to an advanced level.

There are nine different sections within the book covering Computer Graphics
(including GUIs), Games, Testing, File Input and Output, Databases Access, Logging, Concurrency and Parallelism, Reactive programming, and Networking. Each section is self-contained and can either be read on its own or as part of the book as a whole.

This book is aimed at the those who have learnt the basics of the Python 3 language
but want to delve deeper into Python’s eco system of additional libraries and modules,
to explore concurrency and parallelism, to create impressive looking graphical interfaces, to work with databases and files and to provide professional logging facilities.
Buy: Advanced Guide to Python 3 Programming (Undergraduate Topics in Computer Science) Paperback – 30 September 2019 by John Hunt (Author)
PDF Download:

A Beginners Guide to Python 3 Programming for Undergraduate Topics in Computer Science by John Hunt PDF

This textbook on Python 3 explains concepts such as variables and what they represent, how data is held in memory, how a for loop works and what a string is. It also introduces key concepts such as functions, modules and packages as well as object orientation and functional programming. Each section is prefaced with an introductory chapter, before continuing with how these ideas work in Python.

Topics such as generators and coroutines are often misunderstood and these are explained in detail, whilst topics such as Referential Transparency, multiple inheritances and exception handling are presented using examples.

A Beginners Guide to Python 3 Programming provides all you need to know about Python, with numerous examples provided throughout including several larger worked case studies illustrating the ideas presented in the previous chapters.
Buy: A Beginners Guide to Python 3 Programming (Undergraduate Topics in Computer Science) Kindle Edition by John Hunt (Author) Format: Kindle Edition
PDF Download :

Maximum Occurring character | Python | Castor Classes

Code:


t=int(input());
i=0;
while(i<t):
    a=input();
    character='';
    count=0;
    output=a[0];
    max=a.count(output);
    for ig in a:
        c=a.count(ig);
        if(c>max):
            max=c;
            output=ig;
        elif(c==max and output>ig):
            output=ig;
    print(output);
    i=i+1;

Python for beginners: https://www.youtube.com/watch?v=egq7Z...

Join us : t.me/clcoding_python

Sum of Digits of a number | Python | Castor Classes

Code: t=int(input()); i=0; while(i<t): a=int(input()); w=str(a); e=list(w); output=0; for ij in e: output=output+int(ij); print(output); i=i+1;

Python for beginners: https://www.youtube.com/watch?v=egq7Z...

Check whether K-th bit is set or not | Python | Castor Classes

Code:


t=int(input());
i=0;
while(i<t):
    a=int(input());
    k=int(input());
    w=bin(a);
    w=w[2:];
    if(w[len(w)-k-1]=='1'):
        print("Yes");
    else:
        print("No");
    i=i+1;
Python for beginners: https://www.youtube.com/watch?v=egq7Z...

A Primer on Scientific Programming with Python (Texts in Computational Science and Engineering Book 6) Kindle Edition by Hans Petter Langtangen (Author)

The book serves as a first introduction to computer programming of scientific applications, using the high-level Python language. The exposition is example and problem-oriented, where the applications are taken from mathematics, numerical calculus, statistics, physics, biology and finance. The book teaches "Matlab-style" and procedural programming as well as object-oriented programming. High school mathematics is a required background and it is advantageous to study classical and numerical one-variable calculus in parallel with reading this book. Besides learning how to program computers, the reader will also learn how to solve mathematical problems, arising in various branches of science and engineering, with the aid of numerical methods and programming. By blending programming, mathematics and scientific applications, the book lays a solid foundation for practicing computational science.

From the reviews: Langtangen … does an excellent job of introducing programming as a set of skills in problem solving. He guides the reader into thinking properly about producing program logic and data structures for modeling real-world problems using objects and functions and embracing the object-oriented paradigm. … Summing Up: Highly recommended.

F. H. Wild III, Choice, Vol. 47 (8), April 2010

Those of us who have learned scientific programming in Python ‘on the streets’ could be a little jealous of students who have the opportunity to take a course out of Langtangen’s Primer.”
John D. Cook, The Mathematical Association of America, September 2011

This book goes through Python in particular, and programming in general, via tasks that scientists will likely perform. It contains valuable information for students new to scientific computing and would be the perfect bridge between an introduction to programming and an advanced course on numerical methods or computational science.
Alex Small, IEEE, CiSE Vol. 14 (2), March /April 2012

“This fourth edition is a wonderful, inclusive textbook that covers pretty much everything one needs to know to go from zero to fairly sophisticated scientific programming in Python…”
Joan Horvath, Computing Reviews, March 2015

Buy: A Primer on Scientific Programming with Python (Texts in Computational Science and Engineering Book 6) Kindle Edition by Hans Petter Langtangen (Author)
PDF Download: 


Popular Posts

Categories

100 Python Programs for Beginner (49) AI (34) Android (24) AngularJS (1) Assembly Language (2) aws (17) Azure (7) BI (10) book (4) Books (173) C (77) C# (12) C++ (82) Course (67) Coursera (226) Cybersecurity (24) data management (11) Data Science (128) Data Strucures (8) Deep Learning (20) Django (14) Downloads (3) edx (2) Engineering (14) Excel (13) Factorial (1) Finance (6) flask (3) flutter (1) FPL (17) Google (34) Hadoop (3) HTML&CSS (47) IBM (25) IoT (1) IS (25) Java (93) Leet Code (4) Machine Learning (59) Meta (22) MICHIGAN (5) microsoft (4) Nvidia (3) Pandas (4) PHP (20) Projects (29) Python (929) Python Coding Challenge (351) Python Quiz (22) Python Tips (2) Questions (2) R (70) React (6) Scripting (1) security (3) Selenium Webdriver (3) Software (17) SQL (42) UX Research (1) web application (8) Web development (2) web scraping (2)

Followers

Person climbing a staircase. Learn Data Science from Scratch: online program with 21 courses