1answer.
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
baherus [9]
4 years ago
12

Loops are frequently used to ____; that is, to make sure it is meaningful and useful.

Computers and Technology
1 answer:
Pachacha [2.7K]4 years ago
5 0

the answer to this is B. validate data "Loops are frequently used to <u>validate data</u>; that is, to make sure it is meaningful and useful."

You might be interested in
Write two methods: encrypt and decrypt. encrypt should #take as input a string, and return an encrypted version #of it according
Harman [31]

Answer:

The code is given below with appropriate comments

Explanation:

CIPHER = (("D", "A", "V", "I", "O"),

         ("Y", "N", "E", "R", "B"),

         ("C", "F", "G", "H", "K"),

         ("L", "M", "P", "Q", "S"),

         ("T", "U", "W", "X", "Z"))

# Add your code here!

def encrypt(plaintext):

   theList = []

   for char in plaintext:

       if char.isalpha():

           char = char.upper()

           if char == "J":

               char = "I"

           theList.append(char)

   if len(theList) % 2 == 1:

       theList.append("X")

   for i in range(0, len(theList), 2):

       if theList[i] == theList[i + 1]:

           theList[i + 1] = "X"

       findex = [-1, -1]

       sindex = [-1, -1]

       for j in range(len(CIPHER)):

           for k in range(len(CIPHER)):

               if theList[i] == CIPHER[j][k]:

                   findex = [j, k]

               if theList[i + 1] == CIPHER[j][k]:

                   sindex = [j, k]

       # same row

       if (findex[0] == sindex[0]):

           findex[1] += 1

           sindex[1] += 1

           if findex[1] == 5:

               findex[1] = 0

           if sindex[1] == 5:

               sindex[1] = 0

           theList[i] = CIPHER[findex[0]][findex[1]]

           theList[i + 1] = CIPHER[sindex[0]][sindex[1]]

       # same column

       elif (findex[1] == sindex[1]):

           findex[0] += 1

           sindex[0] += 1

           if findex[0] == 5:

               findex[0] = 0

           if sindex[0] == 5:

               sindex[0] = 0

           theList[i] = CIPHER[findex[0]][findex[1]]

           theList[i + 1] = CIPHER[sindex[0]][sindex[1]]

       else:

           theList[i] = CIPHER[findex[0]][sindex[1]]

           theList[i + 1] = CIPHER[sindex[0]][findex[1]]

   return "".join(theList)

def decrypt(ciphertext):

   theString = ""

   findex = [-1, -1]

   sindex = [-1, -1]

   for i in range(0, len(ciphertext), 2):

       for j in range(len(CIPHER)):

           for k in range(len(CIPHER)):

               if ciphertext[i] == CIPHER[j][k]:

                   findex = [j, k]

               if ciphertext[i + 1] == CIPHER[j][k]:

                   sindex = [j, k]

       if (findex[0] == sindex[0]):

           findex[1] -= 1

           sindex[1] -= 1

           if findex[1] == -1:

               findex[1] = 4

           if sindex[1] == -1:

               sindex[1] = 4

           theString += CIPHER[findex[0]][findex[1]]

           theString += CIPHER[sindex[0]][sindex[1]]

       # same column

       elif (findex[1] == sindex[1]):

           findex[0] -= 1

           sindex[0] -= 1

           if findex[0] == -1:

               findex[0] = 4

           if sindex[0] == -1:

               sindex[0] = 4

           theString += CIPHER[findex[0]][findex[1]]

           theString += CIPHER[sindex[0]][sindex[1]]

       else:

           theString += CIPHER[findex[0]][sindex[1]]

           theString += CIPHER[sindex[0]][findex[1]]

   return theString

# Below are some lines of code that will test your function.

# You can change the value of the variable(s) to test your

# function with different inputs.

#

# If your function works correctly, this will originally

# print: QLGRQTVZIBTYQZ, then PSHELXOWORLDSX

print(encrypt("PS. Hello, worlds"))

print(decrypt("QLGRQTVZIBTYQZ"))

5 0
3 years ago
Assume three jobs arrive at approximately the same time (arrival time are all 0), but Job A arrives slightly before Job B, and J
Komok [63]

Answer:

Explanation:

Correct:

8 0
3 years ago
Write programs for two MSP430 boards to do the following:
Rainbow [258]

Answer:

Explanation:

#include "msp430g2553.h"

#define TXLED BIT0

#define RXLED BIT6

#define TXD BIT2

#define RXD BIT1

const char string[] = { "Hello World\r\n" };

unsigned int i; //Counter

int main(void)

{

WDTCTL = WDTPW + WDTHOLD; // Stop WDT

DCOCTL = 0; // Select lowest DCOx and MODx settings

BCSCTL1 = CALBC1_1MHZ; // Set DCO

DCOCTL = CALDCO_1MHZ;

P2DIR |= 0xFF; // All P2.x outputs

P2OUT &= 0x00; // All P2.x reset

P1SEL |= RXD + TXD ; // P1.1 = RXD, P1.2=TXD

P1SEL2 |= RXD + TXD ; // P1.1 = RXD, P1.2=TXD

P1DIR |= RXLED + TXLED;

P1OUT &= 0x00;

UCA0CTL1 |= UCSSEL_2; // SMCLK

UCA0BR0 = 0x08; // 1MHz 115200

UCA0BR1 = 0x00; // 1MHz 115200

UCA0MCTL = UCBRS2 + UCBRS0; // Modulation UCBRSx = 5

UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**

UC0IE |= UCA0RXIE; // Enable USCI_A0 RX interrupt

__bis_SR_register(CPUOFF + GIE); // Enter LPM0 w/ int until Byte RXed

while (1)

{ }

}

#pragma vector=USCIAB0TX_VECTOR

__interrupt void USCI0TX_ISR(void)

{

P1OUT |= TXLED;

UCA0TXBUF = string[i++]; // TX next character

if (i == sizeof string - 1) // TX over?

UC0IE &= ~UCA0TXIE; // Disable USCI_A0 TX interrupt

P1OUT &= ~TXLED; }

#pragma vector=USCIAB0RX_VECTOR

__interrupt void USCI0RX_ISR(void)

{

P1OUT |= RXLED;

if (UCA0RXBUF == 'a') // 'a' received?

{

i = 0;

UC0IE |= UCA0TXIE; // Enable USCI_A0 TX interrupt

UCA0TXBUF = string[i++];

}

P1OUT &= ~RXLED;

}

7 0
4 years ago
The smaller RAM a computer has, the more software you can have open without impacting the speed of your computer
dsp73
False, forsure mates but gotta love the question:)
4 0
3 years ago
A method in a class that modifies information about an object is called a/an ____ method.
exis [7]
<span>A method in a class that modifies information about an object is called a <u>mutator</u> method.</span>
7 0
3 years ago
Other questions:
  • You are designing a distributed application for Azure. The application must securely integrate with on-premises servers. You nee
    13·2 answers
  • While creating your résumé, what should you do before making a final copy to fix any typos or errors?
    6·1 answer
  • Can you give me a long list of kid's cartoons
    8·2 answers
  • Suppose the length of each packet is L bits. Also, assume the path from a server to a client includes N links each of rate R (i.
    8·1 answer
  • Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follo
    13·1 answer
  • Text messaging is an example of nonverbal communication. Please select the best answer from the choices provided. T F
    7·2 answers
  • A local bank has an in-house application which handles sensitive financial data in a private subnet. After the data is processed
    15·1 answer
  • "The ______ of an operational system that supports an organization includes policies, requirements, and conditional statements t
    13·1 answer
  • If a triathlon is a sport combining three events, what do you think would be the word for a sport combining five events?
    7·1 answer
  • Select the correct answer
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!