prshntshinde / pw-datascience Goto Github PK
View Code? Open in Web Editor NEWRepository for all contents related to PW DS course.
Repository for all contents related to PW DS course.
Q1. Which keyword is used to create a function? Create a function to return a list of odd numbers in the
range of 1 to 25.
Q2. Why *args and **kwargs is used in some functions? Create a function each for *args and **kwargs to
demonstrate their use.
Q3. What is an iterator in python? Name the method used to initialise the iterator object and the method
used for iteration. Use these methods to print the first five elements of the given list [2, 4, 6, 8, 10, 12, 14, 16,
18, 20].
Q4. What is a generator function in python? Why yield keyword is used? Give an example of a generator
function.
Q5. Create a generator function for prime numbers less than 1000. Use the next() method to print the
first 20 prime numbers.
Note: Create your assignment in Jupyter notebook
Resource:- https://drive.google.com/file/d/1XSaezX1ChhjPIyneNElkR7CRgS28RWKn/view
Q1. You are writing code for a company. The requirement of the company is that you create a Python
function that will check whether the password entered by the user is correct or not. The function should
take the password as input and return the string “Valid Password” if the entered password follows the
below-given password guidelines else it should return “Invalid Password”.
Note: 1. The Password should contain at least two uppercase letters and at least two lowercase letters.
2. The Password should contain at least a number and three special characters.
3. The length of the password should be 10 characters long.
Q2. Solve the below-given questions using at least one of the following:
https://drive.google.com/file/d/1CEHxdCxe84bz-2vn059PQTv2APIsk12Y/view?usp=sharing
Q1. What are the characteristics of the tuples? Is tuple immutable?
Q2. What are the two tuple methods in python? Give an example of each method. Give a reason why
tuples have only two in-built methods as compared to Lists.
Q3. Which collection datatypes in python do not allow duplicate items? Write a code using a set to remove
duplicates from the given list.
List = [1, 1, 1, 2, 1, 3, 1, 4, 2, 1, 2, 2, 2, 3, 2, 4, 3, 1, 3, 2, 3, 3, 3, 4, 4, 1, 4, 2, 4, 3, 4, 4]
Q4. Explain the difference between the union() and update() methods for a set. Give an example of
each method.
Q5. What is a dictionary? Give an example. Also, state whether a dictionary is ordered or unordered.
Q6. Can we create a nested dictionary? If so, please give an example by creating a simple one-level
nested dictionary.
Q7. Using setdefault() method, create key named topics in the given dictionary and also add the value of
the key as this list ['Python', 'Machine Learning’, 'Deep Learning']
dict1 = {'language' : 'Python', 'course': 'Data Science Masters'}
Q8. What are the three view objects in dictionaries? Use the three in-built methods in python to display
these three view objects for the given dictionary.
dict1 = {'Sport': 'Cricket' , 'Teams': ['India', 'Australia', 'England', 'South Africa', 'Sri Lanka', 'New Zealand']}
Note: Create your assignment in Jupyter notebook and upload it in GitHub & share that github
repository link through your dashboard.
Q1, Create a vehicle class with an init method having instance variables as name_of_vehicle, max_speed
and average_of_vehicle.
Q2. Create a child class car from the vehicle class created in Que 1, which will inherit the vehicle class.
Create a method named seating_capacity which takes capacity as an argument and returns the name of
the vehicle and its seating capacity.
Q3. What is multiple inheritance? Write a Python code to demonstrate multiple inheritance.
Q4. What are getter and setter in Python? Create a class and create a getter and a setter method in this
class.
Q5.What is method overriding in Python? Write a Python code to demonstrate method overriding.
Q1. What is MongoDB? Explain non-relational databases in short. In which scenarios it is preferred to use
MongoDB over SQL databases?
Q2. State and Explain the features of MongoDB.
Q3. Write a code to connect MongoDB to Python. Also, create a database and a collection in MongoDB.
Q4. Using the database and the collection created in question number 3, write a code to insert one record,
and insert many records. Use the find() and find_one() methods to print the inserted record.
Q5. Explain how you can use the find() method to query the MongoDB database. Write a simple code to
demonstrate this.
Q6. Explain the sort() method. Give an example to demonstrate sorting in MongoDB.
Q7. Explain why delete_one(), delete_many(), and drop() is used.
Q1. Create a python program to sort the given list of tuples based on integer value using a
lambda function.
[('Sachin Tendulkar', 34357), ('Ricky Ponting', 27483), ('Jack Kallis', 25534), ('Virat Kohli', 24936)]
Q2. Write a Python Program to find the squares of all the numbers in the given list of integers using
lambda and map functions.
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Q3. Write a python program to convert the given list of integers into a tuple of strings. Use map and
lambda functions
Given String: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Expected output: ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10')
Q4. Write a python program using reduce function to compute the product of a list containing numbers
from 1 to 25.
Q5. Write a python program to filter the numbers in a given list that are divisible by 2 and 3 using the
filter function.
[2, 3, 6, 9, 27, 60, 90, 120, 55, 46]
Q6. Write a python program to find palindromes in the given list of strings using lambda and filter
function.
['python', 'php', 'aba', 'radar', 'level']
Note: Create your assignment in Jupyter notebook and upload it to GitHub & share that GitHub repository
link through your dashboard.
Resource: https://drive.google.com/file/d/1eTprnAgMQwfftn7w2gg0-nvSV-eb2FE2/view
Q1. Explain why we have to use the Exception class while creating a Custom Exception.
Note: Here Exception class refers to the base class for all the exceptions.
Q2. Write a python program to print Python Exception Hierarchy.
Q3. What errors are defined in the ArithmeticError class? Explain any two with an example.
Q4. Why LookupError class is used? Explain with an example KeyError and IndexError.
Q5. Explain ImportError. What is ModuleNotFoundError?
Q6. List down some best practices for exception handling in python.
Q1. Which function is used to open a file? What are the different modes of opening a file? Explain each mode
of file opening.
Q2. Why close() function is used? Why is it important to close a file?
Q3. Write a python program to create a text file. Write ‘I want to become a Data Scientist’ in that file. Then
close the file. Open this file and read the content of the file.
Q4. Explain the following with python code: read(), readline() and readlines().
Q5. Explain why with statement is used with open(). What is the advantage of using with statement and
open() together?
Q6. Explain the write() and writelines() functions. Give a suitable example.
11th Feb
Q1. What is a database? Differentiate between SQL and NoSQL databases.
Q2. What is DDL? Explain why CREATE, DROP, ALTER, and TRUNCATE are used with an example.
Q3. What is DML? Explain INSERT, UPDATE, and DELETE with an example.
Q4. What is DQL? Explain SELECT with an example.
Q5. Explain Primary Key and Foreign Key.
Q6. Write a python code to connect MySQL to python. Explain the cursor() and execute() method.
Q7. Give the order of execution of SQL clauses in an SQL query.
Q1. Explain Class and Object with respect to Object-Oriented Programming. Give a suitable example.
Q2. Name the four pillars of OOPs.
Q3. Explain why the init() function is used. Give a suitable example.
Q4. Why self is used in OOPs?
Q5. What is inheritance? Give an example for each type of inheritance.
Resources: https://drive.google.com/file/d/1vaRzja9zRf2UqKKwRn5xMX1ORy2qESWL/view
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.