How to Form a Two-bit Integer from a Given Number in Python


In this example we will show us how to form a two-bit integer where its tens place is the number of the one’s place of the original number, and the one’s place remains the same.

Source Code

#! /usr/bin/env python3
# -*- coding: utf-8 -*-

n = int(input("Enter the number:"))
a = str(n)
b = str(len(a))
c = a[-1]
d = b + c
print("The formed number is: ",int(d))

Output:

Enter the number:345
The formed number is: 35

Enter the number:15698
The formed number is: 58
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments