answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Shtirlitz
2 months ago
14

Create a different version of the program that: Takes a 3-digit number and generates a 6-digit number with the 3-digit number re

peated, 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.
Computers and Technology
1 answer:
Harlamova29_29 [1K]2 months ago
4 0

Answer:

#1

threedigit = int(input("Please enter a three-digit number: "))

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

     print("The input should consist of three digits")

else:

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

#2  

fivedigit = int(input("Please enter a five-digit number: "))

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

     print("The input should consist of five digits")

else:

     print(str(fivedigit * 11 * 9091))

Explanation:

Starting with the first program

#1

This line requests a three-digit input from the user

threedigit = int(input("Please enter a three-digit number: "))

The if condition below verifies that the input has exactly 3 digits

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

     print("The input should consist of three digits")

else:

     print(str(threedigit * 7 * 11 * 13)) -> This line runs when there are 3 digits

Proceeding to the second program

#2  

This line requests a five-digit input from the user

fivedigit = int(input("Please enter a five-digit number: "))

The if condition below verifies that the input has exactly 5 digits

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

     print("The input should consist of five digits")

else:

     print(str(fivedigit * 11 * 9091)) -> This line runs when there are 5 digits

You might be interested in
Cindy visits her favorite website on a lunch break using a hospital computer. After she downloads a file, she notices that the c
Amiraneli [1052]

Explanation:

Keep in mind that Malware is derived from the terms Malicious-Software (Mal...ware). Therefore, Malware can be understood as software that is deliberately created by cybercriminals to infiltrate or damage a computer or network.

a.

Cindy might discover the distinction between these two methods used for executing a malware attack:

  • via downloads from harmful websites: An attacker may create a harmful website where unsuspecting visitors might click to download various files, which will end up installing malware software onto their systems.
  • through phishing emails: These emails may have attachments that, if they are opened or downloaded by an unaware user, will result in malware infecting their system.

b. Here are several basic precautions;

  • Avoid opening attachments from unfamiliar email addresses.
  • install a reputable paid antivirus program.
  • be cautious of websites overloaded with advertisements.
4 0
1 month ago
Assume that you are testing the Orders database introduced in Watt (2014) - Appendix C. Discuss the problems and possible conseq
ivann1987 [1066]

Answer:

129 \frac{2}{?} 23.4. \div 164 \times 5y1 +. \\.00487ggh

6 0
2 months ago
Given main(), define the Team class (in file Team.java). For class method getWinPercentage(), the formula is:teamWins / (teamWin
amid [951]

Answer:

Explanation:

public class Team {

   private String teamName;

   private int teamWins;

   private int teamLosses;

   public String getTeamName() {

       return teamName;

   }

   public void setTeamName(String teamName) {

       this.teamName = teamName;

   }

   public int getTeamWins() {

       return teamWins;

   }

   public void setTeamWins(int teamWins) {

       this.teamWins = teamWins;

   }

   public int getTeamLosses() {

       return teamLosses;

   }

   public void setTeamLosses(int teamLosses) {

       this.teamLosses = teamLosses;

   }

   public double getWinPercentage() {

       return teamWins / (double) (teamWins + teamLosses);

   }

}

7 0
2 months ago
In mathematics, the factorial of a positive integer n, denoted as n! , is the product of all positive integers less than or equa
oksian1 [950]
public static int factorial(int n) { if (n >= 1 && n <=12) { if (n == 1) return 1; else return n * factorial(n - 1); } else return -1; } Explanation: The factorial method takes a single integer n as input. It checks if n is within the range of 1 to 12. If it is, it further checks if n equals 1. If it is indeed 1, it returns 1 as the factorial. Otherwise, it recursively calls itself with n decreased by 1, multiplying the result by n. If n is outside this range, the method returns -1 indicating the input is invalid.
6 0
2 months ago
Read 2 more answers
Which of the following is an absolute cell reference
Amiraneli [1052]
The term for the contents of the cell is an absolute cell reference. Excel allows each cell to contain numbers, strings, or formulas. Users can enter values into a cell and apply built-in formulas to perform calculations and obtain results in the target cell. When users attempt to copy and paste data into another cell, they can use the paste special option to select values, meaning that only the data is copied, excluding the formula; this is known as the absolute reference of the cell. With paste special, users can also replicate images or Unicode.
6 0
2 months ago
Other questions:
  • Write a statement that reads a floating point value from standard input into temperature. Assume that temperature. has already b
    6·1 answer
  • The principal that users have access to only network resources when an administrator explicitly grants them is called __________
    6·1 answer
  • What advantage do ExpressCard modules and USB adapters offer over expansion cards?
    5·1 answer
  • JAVA Write a program that first asks the user to type a letter grade and then translates the letter grade into a number grade. L
    9·1 answer
  • The act of infiltrating a remote computer system is called​
    14·1 answer
  • Write a program whose input is a string which contains a character and a phrase, and whose output indicates the number of times
    8·1 answer
  • Write a function in the cell below that iterates through the words in file_contents, removes punctuation, and counts the frequen
    6·1 answer
  • Write a statement that defines an ifstream object named inputFile and opens a file named "Friends.txt".
    13·1 answer
  • In QlikView, ________ are used to search information anywhere in the document.
    8·1 answer
  • Social networking sites like Office Online, PayPal, and Dropbox are used to develop social and business contacts.
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!