Home | | Problem Solving and Python Programming | Python Programs - Data, Expressions, Statements

# Python Programs - Data, Expressions, Statements

Problem Solving and Python Programming : Data, Expressions, Statements

ILLUSTRATIVE PROGRAMS

## Program for SWAPPING(Exchanging )of values

a = int(input("Enter a value "))

b = int(input("Enter b value "))

c = a

a = b

b = c

print("a=",a,"b=",b,)

Output

Enter a value 5

Enter b value 8

a=8

b=5

## Program to find distance between two points

import math

x1=int(input("enter x1"))

y1=int(input("enter y1"))

x2=int(input("enter x2"))

y2=int(input("enter y2"))

distance =math.sqrt((x2-x1)**2)+((y2-

y1)**2)

print(distance)

enter x1 7

enter y1 6

enter x2 5

enter y2 7

2.5

## Program to circulate n numbers

a=list(input("enter the list"))

print(a)

for i in range(1,len(a),1):

print(a[i:]+a[:i])

### Output:

enter the list '1234'

['1', '2', '3', '4']

['2', '3', '4', '1']

['3', '4', '1', '2']

['4', '1', '2', '3']

Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
Problem Solving and Python Programming : Data, Expressions, Statements : Python Programs - Data, Expressions, Statements |