ERFAN
ERFAN

Reputation: 23

Divide two-digit numbers into two separate parts in python

I want to divide a two-digit number into two different parts For example: 12 to 1 and 2, 87 to 8 and 7 Thanks

Upvotes: 1

Views: 953

Answers (1)

Aldrin Saurov Sarker
Aldrin Saurov Sarker

Reputation: 213

# Your integer number is in 'num' variable
num = str(num)
a, b = num[0], num[1]

Upvotes: 1

Related Questions