100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
"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 $11.49   Add to cart

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

 3 views  0 purchase
  • Course
  • Institution

"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 P...

[Show more]

Preview 4 out of 122  pages

  • May 17, 2024
  • 122
  • 2023/2024
  • Other
  • Unknown
avatar-seller
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

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller gokulakrishnans. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $11.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

82956 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$11.49
  • (0)
  Add to cart