Q. Write a void function that receives a 4 digit number and calculate the sum of the square of first 2 digits number and last digits number.
Answer =
def void (x):
return int (x[:2])**2 + int (x[2:])**2
num = input ("Enter the four digit number :- ")
print (void(num))
Output :-
Enter the four digit number :- 1234
1300
>>>
Enter the four digit number :- 1111
242
>>>
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )