Answer to Question #316157 in Python for mounika

Question #316157

given a four digit number N as input. write a program to print first and last digit of the number


1
Expert's answer
2022-03-22T15:20:11-0400
num = int(input("Input number N: "))
last = num % 10
while (num > 10):
    num = num // 10
first = num % 10     
print(f'\nFirst digit: {first} \nLast digit: {last}') 

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