1.How to find the absolute difference of two integers
x,y=[int(i) for i in input().split()]
print(abs(x-y))
2.How to find the ascii value of a character
ch='A'
print(ord(ch))
3.palindrome of a number
num=str(input()) #input 505
if(num==num[::-1]):
print("given data is palindrome")
else:
print("not a palindrome") #output given data is palindrome
4.Swapping of two numbers
a,b=input().split() #input 5,10
a,b=b,a
print(a,b) #output 10,5
5.Printing list data with their respective index
for index,value in enumerate([1,5,9,"hello","world"]):
print(index,value)
No comments:
Post a Comment