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 Relationship between binary representation of n & n-1 | Python | Castor Classes Python for beginners:


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

Let's learn Python from basics.

Data Type Conversion | Python | Castor Classes Python for beginners:


Like us:

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

Bitwise Operation in Python | Castor Classes Python for beginners:






Like us:

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 Python for beginners:

Nested List & Matrix | List in Python | Part 7

Python for beginners:

#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:"));
while i<row:
    while j<column:

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:

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:


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 List in Python | Part 2 | Castor Classes Python for beginners:

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:

Web 🌐 Telegram:

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

Sum of Digits of a number | Python | Castor Classes Python for beginners:

Maximum 69 Number | Python

Check the problem statement here: Prerequisite: List in Python | Part 6 | Castor Classes

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

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


    for ig in a:
        elif(c==max and output>ig):

Python for beginners:

Join us :

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:

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


Python for beginners:

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: 

Sunday 26 April 2020

What is Variable, Datatype and C# Datatypes

Variables :
  • It is location in memory (RAM) to temporary store a value during execution of Program / Software.
  • As the name suggests, the value of variable can change during execution of program.
  • A variable is made of 3 things.
                - Datatype
                - Name
                - Value (optional)

DataType :
   - It means what type of value we can store in the variable.
  • Numbers such 123, 10.50 etc
  • Strings such as UK, Canada etc
  • Data such 11/4/2020

Name :
  • It identifies the variable. For example, firstName, lastName, age
Value :
  • What actual value is stored in variable.
List of DataTypes in C# :
  1. Integer → Numbers such as 120, 345 etc
  2. Decimal → Number such as 3.5, 4.5 etc
  3. Char → Single character such as A,a,B,z
  4. Bool → True or False value
  5. String → More than one characters value such as John Smith, Mark Smith, Canada , Landon etc.
Syntax :
              DataType variableName = value;

Naming Rules :
 一  Names may consists of letters (A-Z or a-z), digits and underscores
  •  e.g firstName, firstNumber, _Age, firstNumber1 (correct)
  • #FirstName, @Email (wrong)

一 Name must begin with a letter or underscore.
  • e.g. firstName or _firstName (correct)
  • 1stName or 2ndNumber (wrong)
一Name must not have spaces.
  • e.g. first Name (wrong)
  • firstName (correct)
一 Names must not have reserved word or C# keywords. List of C# keyword are shown in the table.

Naming Conventions :
ー Names must be meaningful
  • e.g. firstNameString, cnicString, studentldlnteger (correct)
  • a,b, obj1 (wrong)
ー  Name must include its datatype
  • e.g. firstNameString, cnicString, studentldlnteger (correct)
  • FirstName, firstname, CNIC or Studentld (wrong)
ー Name must begin with lowercase letter and then capitalize each word of the name
  • e.g. firstNameString, cnicString, studentldinteger (correct)
  • FirstName, firstname, CNIC or StudentId (wrong)

Introduction of C# | First C# Program | C# Vs Java |

C# Introduction 
  • Computer Programming : It is a process of creating computer programs or in other word software to solve particular problem. 
               - Word Processor
               - Hospital Management
               - Spreadsheet
  • It is a Object Oriented Programming Language from Microsoft Corporation in year 2000.
  • C# is a part of .Net Framework and currently in version 16.3.
  • It is helps in developing variety of application such as windows based, Database based, Web Services, Web Application and more. 
C# Vs Java : Both are Object Oriented

C# - 
  1. Required CLR (Common Language RunTime)
  2. GOTO Statement is present
  3. Support Structure and Unions
  4. Support Unchecked Exception
  5. Less Secure than Java
Java -
  1. Required JRE (Java Runtime Environment)
  2. No GOTO statement 
  3. No Structure and Union
  4. Supports both Checked and Unchecked Exception
  5. Much Secure
First C# Program :-

Python Programming Fundamentals (Undergraduate Topics in Computer Science) Kindle Edition by Kent D. Lee (Author) pdf

This easy-to-follow and classroom-tested textbook guides the reader through the fundamentals of programming with Python, an accessible language which can be learned incrementally.

Features: incudes numerous examples and practice exercises throughout the text, with additional exercises, solutions and review questions at the end of each chapter; highlights the patterns which frequently appear when writing programs, reinforcing the application of these patterns for problem-solving through practice exercises; introduces the use of a debugger tool to inspect a program, enabling students to discover for themselves how programs work and enhance their understanding; presents the Tkinter framework for building graphical user interface applications and event-driven programs; provides instructional videos and additional information for students, as well as support materials for instructors, at an associated website.
Buy: Python Programming Fundamentals (Undergraduate Topics in Computer Science) Kindle Edition by Kent D. Lee (Author)
Buy: Python Programming Fundamentals (Undergraduate Topics in Computer Science) Kindle Edition by Kent D. Lee (Author)

PDF Download:

List in Python | Part 6 | Castor Classes

Topics covered in this video: 1)max 2)min 3)index 4)lexicographical sorting of list made of string element Python for beginners:

Popular Posts


AI (27) Android (24) AngularJS (1) Assembly Language (2) aws (17) Azure (7) BI (10) book (4) Books (118) C (77) C# (12) C++ (82) Course (62) Coursera (180) Cybersecurity (22) data management (11) Data Science (96) Data Strucures (6) Deep Learning (9) Django (6) Downloads (3) edx (2) Engineering (14) Excel (13) Factorial (1) Finance (6) flutter (1) FPL (17) Google (19) Hadoop (3) HTML&CSS (46) IBM (25) IoT (1) IS (25) Java (92) Leet Code (4) Machine Learning (44) Meta (18) MICHIGAN (5) microsoft (4) Pandas (3) PHP (20) Projects (29) Python (757) Python Coding Challenge (238) Questions (2) R (70) React (6) Scripting (1) security (3) Selenium Webdriver (2) Software (17) SQL (40) UX Research (1) web application (8)


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