Write A Python Program To Check The Validity of A Password Given by The User. The Password

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

1. Write a Python program to check the validity of a password given by the user.

The password
should satisfy the following criteria:
1. Contains at least one letter between a and z
2. Contains at least one number between 5 and 9
3. Contains at least one letter between A and Z
4. Contains at least one special character from *, #, !

2.Python Program to Take in the Marks of 5 Subjects and Display the Grade
3.Python Program to Print all Numbers in a Range Divisible by a Given Number
4.Python Program to Read Two Numbers and Print Their Quotient and Remainder
5.Python Program to Check if a Number is a Palindrome
6. Python Program to Print all Integers that Aren't Divisible by Either 2 or 3 and Lie between 1 and
50.
7. Write a python program to print factorial of a number. Take input from the user.

8. Write the python statement for the following question on the basis of given dataset:

Name Degree Score


RAM BCA 90
EKLAVAY MCA 60
HERRY BCA NaN
MARIYAM BTECH 70
LINDA MCA 80
BILL BCA 75

a) To create the above DataFrame.


b) To print the Degree and maximum marks in each stream.
c) To fill the NaN with 76.
d) To set the index to Name.
e) To count the number of students in MCA.
f) To print the MEAN marks for BCA

9. Following is a dataset provided by a car manufacturing company

Sales Price Advertising Model Fuel

Yes Expensive High Sedan Electric

Yes Affordable Low Sedan CNG

No Expensive High SUV Petrol

No Affordable Low Hatchback CNG

Yes Affordable High Hatchback CNG

No Affordable Low SUV Petrol

Yes Inexpensive High Hatchback Petrol


No Expensive High SUV Electric

Yes Inexpensive High Hatchback Petrol

Yes Inexpensive Low Hatchback Electric

Sales: It is the monthly sales of the car company. 'Yes' implies monthly sales are
more than 8,000, 'no' otherwise

Price: Price of the car.

Advertising: Advertising budget of each company.

Model: It tells the model of car.

Fuel: Whether the car is Electric, Petrol/Diesel consuming or CNG consuming

Fit an appropriate model on the given data to predict whether the sales will be more
than 8,000 a month or not. Also, check the accuracy score of the model.
Additionally, the company is planning to launch a new electric SUV car, which will be
expensive and hence company is planning to do high advertising for the same.
Predict what will be the situation of sales for the same.

10. Following is the dataset given by a school of a random sample of 10 students.

IS_PCM Aggregate Marks Science Marks Maths Marks Gender


1 98 97 98 M
1 97.8 99 95 M
0 95.6 94 98 F
0 89 87 94 F
0 85 86 84 M
0 98.9 97 99 M
1 99 99 100 F
0 95 90 95 M
1 87.8 94 80 F
1 94 90 98 F

Is_PCM: Whether the student took PCM in 11th. 1 means yes.


Scores are of class 10th exams.

Fit logistic regression model on the data to predict whether a student will take PCM or
not. Also, Harsh, a male student has scored 98% on aggregate with 96% in maths and
100% in science. Find whether he would take PCM or not using the fitted regression
model.

11. The following data set is for 10 random songs. Divide the data into 3 clusters and find the
accuracy of the model.
Tempo Duration Year of Release
150 210 2020
111 285 2021
97 217 2013
120 252 2019
107 220 2022
140 123 2020
156 283 2019
163 206 2018
103 195 2020
128 208 2012
Tempo: Beats per minute of a song. Basically, how fast or slow is the song

12. The following data is of some customers, who came to take benefit of IKEA's points for buy with
your time program. Fit an appropriate model on the data to find the accuracy of the same, and also
predict that if a 35 year old person, having a salary of 60,000 drives 130 miles on his BMW which
gives him mileage of 7, will purchase goods from IKEA?

Purchase Distance from Store Age Salary Mileage


1 50 32 57,000.00 11.25
1 100 25 40,000.00 12.50
0 30 45 43,000.00 10.63
0 120 30 54,000.00 10.00
0 60 28 63,000.00 11.25
1 40 31 58,000.00 7.50
0 90 27 84,000.00 7.81
0 80 34 60,000.00 6.25
1 180 24 75,000.00 8.75
1 150 23 1,50,000.00 7.19

13. The following is the data set template of a company that produces automobile.

Yea
Marketing Expense in lacs Sales in the Crores
r
201
5 3.5
1
201
6 4
2
201
4 3
3
201
8 5
4
201
13 9.2
5
201
7 5
6
201 9 6
7
201
10 7.2
8
201
9.5 6.9
9
202
11 8.5
0

As a marketing head of this company build a suitable regression model using the python
libraries to predict the sales of company in future years. 10

14. You have been provided training data including height, weight and T-shirt size of 8 students as
below
Height (in cms) Weight (in kgs) T-Shirt Size
158 58 M
160 60 M
163 60 M
165 62 L
165 65 L
168 62 L
170 64 L
170 68 L

and you need to predict the T-shirt size of a new Student having height 160 cm and weight 62 kgs
using K-Nearest Neighbors algorithm for K=5.

15. Collect the minimum and maximum temperature of your city for a month and present it using a
histogram plot.

16. Following is the dataset regarding the survival of passengers in a train accident

Class Age Gender Survived


1st 29 female 1
1st 30 male 0
1st 47 male 1
2nd 32 female 1
2nd 57 male 0
2nd 18 male 0
2nd 36 female 1
3rd 25 male 0
3rd 18 female 0
3rd 38 female 1

Fit an appropriate Machine learning model to predict whether the person has survived or not.
Also check the accuracy of the model by using the following dataset
Class Age Gender Survived
1st 13 male 0
2nd 33 female 1
3rd 26 male 0

Q. Following is the dataset regarding Debt to Equity ratio and Price to book ratio
of a company
D/E P/B
0.17 6.8
0.71 3.24
0.46 0.05
0.93 0.19
0.11 1.63
0.12 5.07
0.48 3.34
0.05 0.07
0.08 7.92
0.19 0.91

D/E and P/B ratios of 10 companies is given, create 2 clusters for the given
dataset and check in which cluster do the following datapoints fall

D/E P/B
0.65 6.69
0.12 0.83
0.38 3.24
0.05 3.61
0.13 3.39

You might also like