0
How to print first and last numbers in given 4 numbers using python
3 Answers
+ 5
Khadar Basha ,
as you can see in the given answers, your information should be more precise.
it would be the best to give us an input sample and also the resulting outputs.
thanks!
+ 1
please use some proper tags related to specific language and give some more information about your problem.
#python
num=123456789
num=str(num)
print(f"first four : {num[:5]}\nLast Four : {num[-4:]} ")
#output :
first four : 1234
Last Four : 6789
Edit :
num=int(input())
print(f"{str(num)[0]}{str(num)[-1]}")
#input : 1234
#output : 14
0
Input 1234
Output 14