31.6k views
3 votes
Create a different version of the program that: Takes a 3-digit number and generates a 6-digit number with the 3-digit number repeated, for example, 391 becomes 391391. The rule is to multiply the 3-digit number by 7*11*13. Takes a 5-digit number and generates a 10-digit number with the 5-digit number repeated, for example, 49522 becomes 4952249522. The rule is to multiply the 5-digit number by 11*9091.

1 Answer

2 votes

Answer:

#1

threedigit = int(input("Enter any three digit: "))

if not(len(str(threedigit)) == 3):

print("Input must be three digits")

else:

print(str(threedigit * 7 * 11 * 13))

#2

fivedigit = int(input("Enter any five digit: "))

if not(len(str(fivedigit)) == 5):

print("Input must be five digits")

else:

print(str(fivedigit * 11 * 9091))

Step-by-step explanation:

First program begins here

#1

This line prompts user for input of three digits

threedigit = int(input("Enter any three digit: "))

The following if condition checks if user input is exactly 3 digits

if not(len(str(threedigit)) == 3):

print("Input must be three digits")

else:

print(str(threedigit * 7 * 11 * 13)) -> This line is executed if input is 3 digits

Second program begins here

#2

This line prompts user for input of five digits

fivedigit = int(input("Enter any five digit: "))

The following if condition checks if user input is exactly 3 digits

if not(len(str(fivedigit)) == 5):

print("Input must be five digits")

else:

print(str(fivedigit * 11 * 9091)) -> This line is executed if input is 5 digits

User Ricco D
by
5.0k points