PrefaceAcknowledgement1 Introduction1.1 What is a Computer?1.2 Basics of Programming Languages1.2.1 Machine LanguageAdvantages and Disadvantages1.2.2 Assembly Language1.2.3 High Level LanguagesAdvantages of High Level Languages1.3 Interpreter and Compiler1.4 Algorithms and Flowcharts1.4.1 Writing Algorithms1.4.2 Flowcharts1.5 Writing Algorithms and Flowcharts for a Few Important Problems1.5.1 Reversing the Digits of a Given Integer1.5.2 To Verify Whether an Integer is a Prime Number or Not1.5.3 To Organize a Given Set of Numbers in Ascending Order1.5.4 To Find the Square Root of an Integer1.5.5 To find the Factorial for A Given Number1.5.6 To Generate the Fibonacci Series for N Terms1.5.7 To Find the Value of the Power of a Number Raised by Another Integer1.5.8 To Reverse the Order Elements of an Array1.5.9 To Find the Largest Number in an Array1.5.10 To Solve a Quadratic Equation1.6 Why Python?1.7 Installing Python1.7.1 Windows1.7.2 Linux and Unix1.7.3 Macintosh1.8 Other Python Distributions1.9 Keeping in Touch and Up-to-DateExercises2 Identifiers and Data Types2.1 Keywords2.2 Identifiers2.2.1 Rules for Identifiers2.3 Data Types2.4 VaLues and types2.5 Backslash Character Constants2.6 VariablesExercises3 Operators and ExpressionsIntroduction3.1 Arithmetic Operators3.1.1 Integer Arithmetic3.1.2 Large Integers3.1.3 Hexadecimals and Octals3.1.4 Real Arithmetic3.1.5 Mixed Mode Operations3.1.6 Rules for Conversion3.1.7 Explicit Conversions3.2 Relational Operators3.2.1 More Relational Operators3.2.2 Is : The Identity Operator3.3 Logical/Boolean Operators3.4 Assignment Operators3.5 Interactive Mode and Script Mode3.6 Order of Operations3.7 Comments in Python3.8 __Future__In Python3.9 How to Track Errors?3.10 Common Errors3.10.1 Syntax Errors3.10.2 Runtime Errors3.10.3 Semantic ErrorsExercises4 Managing Input and Output OperationsIntroduction4.1 Managing Inputs4.1.1 raw_input() and input() functionsB input() functions4.2 Managing Outputs4.2.1 repr() or str() functions4.2.2 rjust() and format() functionsB Format() function4.3 Frequently Used Formatting SpecifiersA Formatting Floating Point Numbers:B Formatting in Scientific NotationD Justifying FormatE. Formatting IntegersF. Formatting StringsG Formatting Strings (without using methods)eXerCIses5 Decision making and BranchingIntroduction5.1 If Statement5.1.1 Simple if Statement5.1.2 If else statement5.1.3 Nested if else statement5.1.4 else if (elif) ladder Statement5.2 BooLean VaLues (True or False)Exercises6 Decision making and LoopingIntroduction6.1 the While Loop statement6.2 The for Loop statement6.3 the range() Function6.3.1 Range(argument1)function6.3.2 Range(argument1, argument2)function6.3.3 Range(argument1, argument2, argument3) function6.4 The xrange() Function6.5 Jumps in LoopsThe break Statement6.6 Skipping a Part of a LoopThe Continue Statement6.7 The else Clauses on LoopsNote 2: Precautions to be taken in using the else clauseExercises7 FunctionsIntroduction7.1 Types of Functions7.1.1 Built in Functions7.1.2 User Defined FunctionsFunction Call:Important Points to remember:7.2 Incremental Development7.3 Nesting of Functions7.4 BooLean Function7.5 Recursion Function7.6 Checking types : isinstance ( )7.7 Designing and Writing Modules7.8 Global and Local Variables7.9 Default ArgumentsExercises8 ListIntroduction8.1 Definition8.2 The in Operator8.3 Traversing in a List8.4 Nested List8.5 List Operations8.6 List Slices8.7 List Functions8.8 List Methods8.9 Splitting a String Into a List8.10 Inputting List from the Console/Keyboard8.11 Shifting ListsA Left ShiftB Right Shift8.12 Simplifying Coding with List8.13 Copying Lists8.14 Passing Lists to Functions8.15 Searching Lists8.15.1 The Linear Search Method8.15.2 The Binary Search Method8.16 Sorting Lists8.16.1 Selection Sort8.16.2 Insertion sort8.17 Two-Dimensional Lists8.17.1 Processing Two-Dimensional Lists8.17.2 Initializing Lists with Input Values8.17.3 Initializing Lists with random Values8.17.4 Printing Two Dimensional List8.17.5 Summing All Elements8.17.6 Summing Elements by Column8.17.7 Finding the Row with the Largest Sum8.17.8 Random Shuffling8.17.9 Passing Two-Dimensional Lists to functions8.18 Application: Finding the Closest Pair8.19 Multidimensional ListsExercises9 DictionariesIntroduction9.1 Definition9.2 Creating a Dictionary9.3 Adding, Modifying, and Retrieving Values9.4 The Dictionary Methods9.5 Deleting Items9.6 Looping Items9.7 Equality Test9.8 Dictionaries of Dictionaries9.9 Sets9.10 Accessing Sets with Common Functions9.11 Subset and Superset in Sets9.12 Relational Operators in Sets9.13 Set OperationsExercises10 Tuples10.1 Definition10.2 Tuple Assignment10.3 Tuples as Return Values10.4 The Basic Tuple Operations10.5 Variable-Length Argument Tuples10.6 Relationship Between Lists and Tuples10.7 Relationships Between Dictionaries and TuplesExercises11 Files11.1 Introduction11.2 Text Files and Binary Files11.3 Absolute and Relative Filename11.4 Opening A File11.5 Writing Data11.6 Some Commonly Used Methods for File Handling11.7 WrItIng and readIng numerIC dataExercises12 Computational Physics– Application in Physical Systems12.1 Introduction12.2 What Is Computational Physics?12.3 Oscillatory Motion12.3.1 Ideal Simple Harmonic Oscillator12.3.2 Motion of a Damped Oscillator12.4 Stationary States and Time Independent SchrÖdinger Equation12.4.1 Introduction12.4.2 Form of potential12.4.3 Eigen Value problem12.5 Fractals12.5.1 Fractional Dimension (math)12.5.2 The Sierpinski Gasket12.5.3 Assessing Fractal Dimension12.5.4 Beautiful plants12.6 Random Numbers in Computer Simulation12.6.1 Introduction12.6.2 Randomness: Some Intuitive Concepts12.6.3 Random Number Generators12.6.4 Pseudo-Random Number Generators12.6.5 Basic strategy12.6.6 Mid-Square Generator12.6.7 Multiplicative Congruential Generator12.6.8 Mixed Multiplicative Congruential Generator12.6.9 Tests for Randomness12.7 Monte CarLo method12.7.1 Introduction12.7.2 multi-dimensional Integrals:12.7.3 Monte CarLo method: hitting the Bull's eye Blind-folded12.7.4 Application of the Monte Carlo Method: Finding the Value of p12.8 Lorenz EquationExample 12.16.1 Python Implementation (File method)Output of the above Program:ExercisesAppendix I: Objective Type QuestionsObjective Type QuestionsAnswersAppendix II Descriptive Type QuestionsDescriptive Type Questions1 Write a python program to convert decimal numbers to binary numbers.2 Write a python program to reverse the digits of an integer3 Write a python program to find the Greatest common divisor(GCD) of two numbers4 Write a python program to verify a given number is prime or not.5 Write a python program to generate prime numbers between 1 to 100.6 Write a python program to organize a given set of numbers in ascending order using6 Write a python program to find out the Prime numbers from a sequence of Fibonacci series.7 Write a python program to accept a string and convert the given string into a dictionary. From that dictionary, using the concept of reverse lookup, print all the corresponding keys with its corresponding values.ReferencesIndex