Question #218179

Write a program for first and last digits


Expert's answer

#Write a program for first and last digits


num  = int(input("Enter a number : "))


num_str= str(num)
first_digit = int(num_str[0])
last_digit = int(num_str[-1])


print("First digit is ",first_digit)
print("last digit is ",last_digit)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS