Write a program for first and last digits
#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)
Comments
Leave a comment