Posts

Showing posts from July, 2022

Assignment-6

 Submit before 10pm on 08-08-2026 All 3 marks questions from university question papers - Module -2.Read blog.  1 Compare tuples, lists, and dictionaries. 2. Explain the concept of scope and lifetime of variables in Python programming language, with a suitable example. 3.Write a python code to search a string in the given list. 4.Explain lambda functions in Python with an example 5.Let num=[14,[26,52],2,[8,3],56]. Write the expressions for following operations in Python: i) Replace the value 56 with 92 ii) Print the value 8. iii) Remove the value 52 from list 6.Write a Python script to print a dictionary where the keys are numbers between 1 and 15 (both included) and the values are square of keys. 7.Explain the scope and lifetime of variables in Python programming language with a suitable example each. 8.Compare Lists and Tuples with examples. Illustrate the use of __name__ variable.  9 Write a program to swap two numbers using tuple. Get the numbers from the user prompt....

Plotting- Simple plots,setting limits,subplot, semilog, loglog plots

Image
data—plotting—is one of the most important tools for evaluating and understanding scientific data and theoretical predictions. Plotting is not a part of core Python, however,but is provided through one of several possible library modules. The most highly developed and widely used plotting package for Python is matplotlib ( http://matplotlib.sourceforge.net/ ). It is a powerful and flexible program that has become the defacto standard for 2D plotting with Python. Because matplotlib is an external library—in fact it’s a collection of libraries—it must be imported into any routine that uses it. matplotlib makes extensive use of NumPy so the two should be imported together. Therefore, for any program that is to produce 2D plots, you should include the lines import numpy as np import matplotlib.pyplot as plt plot function.   It is used to plot x-y data sets and is written like this plot(x, y) where x and y are arrays (or lists) that have the same size. If the x array is omitted, that...