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
Brut [27]
3 years ago
10

Write a program that prints the numbers 1 - 50. If the number is even print the word 'EVEN!' next to it. If the number is odd pr

int the word 'ODD!' next to it.
Computers and Technology
1 answer:
mamaluj [8]3 years ago
4 0

In python 3.8:

for x in range(1,51):

   print(str(x)+" EVEN!" if x %2==0 else str(x)+" ODD!")

This works for me. Best of luck.

You might be interested in
Controls that are used to assess whether anything went wrong, such as unauthorized access attempts, are called ________ controls
disa [49]
Hey there,
The answer is <span>detective.

Hope this helps :))

~Top
</span>
4 0
3 years ago
Read 2 more answers
write the implementation (.cpp file) of the gastank class of the previous exercise. the full specifiction of the class is:
o-na [289]

Answer: (no specifications)

Explanation:

Given that there is nothing listed about the class there would be no specifications for the class. This part of the question will not provide you with enough information to write code.

4 0
3 years ago
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
Which feature of Microsoft power point allowed you to put a picture in every slide
nasty-shy [4]

Click where you want to insert the picture on the slide.

On the Insert tab, in the Images group, click Pictures.

In the dialog box that opens, browse to the picture that you want to insert, click that picture, and then click Insert.

3 0
3 years ago
What is the feature of ram for beginners
Wittaler [7]

RAM, or Random Access Memory, is physical hardware in a computer that actively stores information that is being used so that it can quickly be retrieved or accessed again soon. If you're running programs on you're computer, they will be using ram. If you plan on using a lot of programs, you will need more RAM.

7 0
3 years ago
Read 2 more answers
Other questions:
  • Physical access, security bypass, and eavesdropping are examples of how access controls can be ________.
    15·1 answer
  • How to add a second screen to your computer?
    7·1 answer
  • What is the difference between a fiber optic cable and a twisted pair cable?
    5·1 answer
  • He has a new Wi-Fi router that connects wirelessly to a new desktop and two new laptops, in addition to multiple smartphones, ta
    8·1 answer
  • 5.) Spam messages account for what percentage of all email?
    15·2 answers
  • The date your Science project is due should be recorded on a daily organizer. Please select the best answer from the choices pro
    14·2 answers
  • Wow, in this century, technology have been the most valuable. What is the worst of using the hi-tech phones
    13·2 answers
  • Given a Scanner reference variable named input that has been associated with an input source consisting of a sequence of lines,
    13·1 answer
  • Who invented pascaline and when?​
    11·2 answers
  • Question is attached as image, please help :&gt;
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!