Computer Science, asked by srirakshaa1405, 7 months ago

Write a program to input a number check for its type and perform the following: [5]

If it is a 4 digit number then swap the first 2 digits and the last two digits

Eg: 2345

Output: Value after swapping: 4523

Else display the last digit.

Answers

Answered by RuwaisnZaid
1

Explanation:

l = []

x = int(input ("enter a no"))

u = l.append(x)

if len(u)==4:

l.insert(len(u-1),0)

l.insert(len(u),1)

for i in l:

print(I,end=" ")

else:

print (l[len(l)-1])

plz followe

marke as brainly

Similar questions