Answer:
int second_to_last = (number/10)%10;
int third_to_last = (number/100)%10;
Explanation:
The first expression int second_to_last = (number/10)%10; first divide the number by ten and then get modulus by dividing by ten again which will then give the second to last digit.
Assuming number is 146 the second to last digit will be 4.
for the second expression int third_to_last = (number/100)%10; first divide the number by hundred and then get modulus by dividing by ten which will then give the third to last digit.
Assuming number is 4368 the third to last digit will be 3.
Answer:
The result of the following code will be 9
Explanation:
There are several operators used in Python to do mathematical calculations.
** operator is used for exponents.
i.e.
a ** b mathematically means a^b
Here in the given code
3 is assigned to numA and 2 is assigned to numB
Result will be equal to 3^2
Hence,
The result of the following code will be 9
I have a feeling you're looking for Microsoft Outlook.
Answer:
def isAnagram(s1, s2):
list1=s1
list2=s2
sortedlist1 = sorted(list1)
sortedlist2 = sorted(list2)
if sortedlist1 == sortedlist2:
print(list1+ " and "+list2+ " are anagram")
else:
print(list1+ " and "+list2+ " are not anagram")
Explanation:
Here is a call to the function isAnagram():
list1 =input("Enter String1 ")
list1 =input("Enter String2 ")
isAnagram(list1,list2)
Attached is the run and output for this program