Answer to Question #218179 in Python for Krish

Question #218179

Write a program for first and last digits


1
Expert's answer
2021-07-19T16:58:53-0400
#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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS