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
miv72 [106K]
3 years ago
8

Create a list of strings based on a list of numbers The rules:_______

Computers and Technology
1 answer:
Delicious77 [7]3 years ago
3 0

Answer:

listNumbers = [34,56,23,56,78,89,98,45,34,33,25,26,67,78]

listString = [ ]

for i in range(14):

   if listNumbers[i]%2!=0 and listNumbers[i]%5==0:

       listString.append("five odd")

   elif listNumbers[i]%5==0 and listNumbers[i]%2==0:

       listString.append("five even")

   elif listNumbers[i]%2==0:

       listString.append("even")

   elif listNumbers[i]%2!=0:

       listString.append("odd")

print(listNumbers)

print(listString)

Explanation:

In python programming language;

  1. Create two lists
  2. The first is a list of numbers and initialize it with random values: listNumbers = [34,56,23,56,78,89,98,45,34,33,25,26,67,78]
  3. The second list is empty and will hold the string values listString = [ ]
  4. Use a for loop to iterate over all the elementts in the list of numbers
  5. Use the modulo operator (%) to chech for multiples of particular numbers as stipulated by the question
  6. Use combination of if/elif statements for each condition
  7. Use the .append method to add the elements into the list of strings
  8. finially output both lists

See attached code and output

You might be interested in
What is the best java 3d modeler library?
LenaWriter [7]
I believe its "Thinking Universe"
5 0
4 years ago
A mnemonic is a tool that you can use when you are studying to help you do which of the following?
hichkok12 [17]
The answer is a. A mnemonic is a tool to aid retention
5 0
3 years ago
Read 2 more answers
What should a valid website have?
zzz [600]
The answer is A.....
4 0
3 years ago
Creating calendar events prevents individuals from being able to schedule a time to collaborate.
Yuliya22 [10]

Answer:

False because calender events help a person remeber when s/he has a event happening that day!

6 0
4 years ago
What is the term for the idea of a major change in a former way of thinking or organizing?
Basile [38]

Answer:

yessir yessiir

Explanation:

8 0
3 years ago
Other questions:
  • When approved for a loan, an individual essentially applied for aid in the area of...
    15·1 answer
  • Jacob wants to be a Steamfitter. He just finished his associate’s degree. Which best describes what he should do next?
    10·2 answers
  • What range of leakage current must trip an IDCI?​
    15·1 answer
  • The popularity of blogging is an example of _____. the public producing the media the public regulating the media both of the ab
    15·2 answers
  • When reading words with a scanner object, a word is defined as ____?
    15·1 answer
  • For this scenario related to turtle drawing, indicate whether it is better to write a loop or a function (or a set of functions)
    13·1 answer
  • Which of the following is an example of a database?
    10·2 answers
  • Is this very epik or not?
    9·2 answers
  • What validation type would you use to check that numbers fell within a certain range? a) range check b)presence check c)check di
    9·1 answer
  • Help!! me!! plsssssssssssssssssssssssssssssssssss
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!