Python Practice › Tuple Programs › Program 44

Tuple of digits to a number

EasyTuple Programs · 44 of 70

Write a Python program to convert a tuple of digits into a number.

Advertisement
Input
(4, 5, 3, 8)
Output
4538

Approach

  1. Build the number with n * 10 + digit.

Solution

Python
number = 0for d in (4, 5, 3, 8):    number = number * 10 + dprint(number)
Output
4538
Advertisement

Learn the concept

New to this topic? Read the lesson, then come back.

More tuple programs

← All 70 Tuple Programs