Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Other

"Unlock your Python potential with over 200 meticulously crafted practice codes, designed to sharpen your skills and elevate your programming prowess. From beginner basics to advanced algorithms, each note is a treasure trove of hands-on exercises, exp

Rating
-
Sold
-
Pages
122
Uploaded on
17-05-2024
Written in
2023/2024

"Unlock your Python potential with over 200 meticulously crafted practice codes, designed to sharpen your skills and elevate your programming prowess. From beginner basics to advanced algorithms, each note is a treasure trove of hands-on exercises, expertly curated to guide you on your journey to Python mastery. Elevate your coding game today!"

Show more Read less
Institution
Course

Content preview

6/7/23, 5:30 PM Milind Mali_Python Practice_200+ - Jupyter Notebook




Milind Mali / Data Scientist / Data Analyst.
#1.basic excercise for begineers

#2.python input and output exercises

#3.python loop exercises

#4.python function exercises

#5.python string exercises

#6.python data structure exercises

#7.python list exercises

#8.python dictionary exercises

#9 python set exercises

#10.python tuple exercises

#11.python date and time exercises

#12.python OOP exercises

#13.python JSON exercises

#14.python Numpy exercises

#15.python pandas exercises

#16.python matplotlib exercises

#17.python random data generation exercises

#18.python database exercises



1. Basic Exercise for Beginners
Excercise 1: Swap the number without using third varible




localhost:8889/notebooks/Desktop/Data Science/Python Practice/Milind Mali_Python Practice_200%2B.ipynb 1/122

,6/7/23, 5:30 PM Milind Mali_Python Practice_200+ - Jupyter Notebook


In [103]:

x=int(input("enter the first number "))
y=int(input("enter the Second number "))

print(x,y)

x=x+y
y=x-y
x=x-y

print(x,y)

enter the first number 4
enter the Second number 5
4 5
5 4


Exercise 2: Write a Program to extract each digit from an integer in the reverse order.

For example, If the given int is 7536, the output shall be “6 3 5 7“, with a space separating the digits.


In [102]:

n=int(input("enter the number: "))

y=str(n)[::-1]

print(y)

type(y)

enter the number: 7536
6357

Out[102]:

str


excercise 3: Write a program that will give you the sum of 3 digits


In [35]:

x=int(input("enter three digit number"))

a=x%10 # we will get last digit

num=x//10 # integer-divison here we will get first two digit

b=num%10 # here we will get last digit of two digit number

c=num//10 # here will get first digit of two digit number

print(a+b+c)

enter three digit number567
18




localhost:8889/notebooks/Desktop/Data Science/Python Practice/Milind Mali_Python Practice_200%2B.ipynb 2/122

,6/7/23, 5:30 PM Milind Mali_Python Practice_200+ - Jupyter Notebook


excercise 4: Write a program that will reverse a four digit number.Also it checks whether the reverse is true.


In [37]:

x=int(input("enter the four digit number "))

a=x%10 # to get last number

num_1=x//10 # to get first three numbers

b=num_1%10 # this way i will get 2nd last number

num_2=num_1//10 # here will get first two digit number

c=num_2%10 # we will get 2 nd number

d=num_2//10 # here we will get 1st digit

#formula for reverse

rev=a*1000+b*100+c*10+d

print(rev)

#now let check whether both number are equal or not

if x==rev:
print(True)
else:
print(False)

enter the four digit number 4567
7654
False


excercise 5: Write a program to find the euclidean distance between two coordinates.


In [40]:

import math




localhost:8889/notebooks/Desktop/Data Science/Python Practice/Milind Mali_Python Practice_200%2B.ipynb 3/122

, 6/7/23, 5:30 PM Milind Mali_Python Practice_200+ - Jupyter Notebook


In [41]:

x1=float(input("x1: "))
y1=float(input("y1: "))
x2=float(input("x2: "))
y2=float(input("y2: "))

x=[x1,y1]
y=[x2,y2]

print("="*100)

print("Eucledian distance for given co-ordinate will be",round(math.dist(x,y),2))

x1: 4
y1: 5
x2: 6
y2: 8
==========================================================================
==========================
Eucledian distance for given co-ordinate will be 3.61


excercise 5: Write a program that will tell whether the given number is divisible by 3 & 6.


In [49]:

num=int(input("enter the number "))

if num%3==0 and num%6==0:
print("the number is divisible by 3 and 6")
else:
print("the number is not divisible by 3 and 6")

enter the number 45
the number is not divisible by 3 and 6


Excercise 6: Write a program that will take three digits from the user and add the square of each digit.


In [53]:

n=int(input("Enter three digit number: "))

#123

a=n%10 #3

num=n//10 #12

b=num%10 #2

c=num//10 #1

output_value=(a**2)+(b**2)+(c**2)

print(output_value)

Enter three digit number: 345
50


localhost:8889/notebooks/Desktop/Data Science/Python Practice/Milind Mali_Python Practice_200%2B.ipynb 4/122

Written for

Course

Document information

Uploaded on
May 17, 2024
Number of pages
122
Written in
2023/2024
Type
OTHER
Person
Unknown

Subjects

$11.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
gokulakrishnans

Get to know the seller

Seller avatar
gokulakrishnans
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
2 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions