Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Overig

"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

Beoordeling
-
Verkocht
-
Pagina's
122
Geüpload op
17-05-2024
Geschreven 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!"

Meer zien Lees minder
Instelling
Vak

Voorbeeld van de inhoud

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

Geschreven voor

Vak

Documentinformatie

Geüpload op
17 mei 2024
Aantal pagina's
122
Geschreven in
2023/2024
Type
OVERIG
Persoon
Onbekend

Onderwerpen

€10,70
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper
Seller avatar
gokulakrishnans

Maak kennis met de verkoper

Seller avatar
gokulakrishnans
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
-
Lid sinds
2 jaar
Aantal volgers
0
Documenten
1
Laatst verkocht
-

0,0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen