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
aleksklad [387]
2 years ago
12

Q1). Write a python program to pass a list to a function and double the odd values and half even values of a list and display li

st elements after changing.​
Computers and Technology
1 answer:
zepelin [54]2 years ago
8 0

Answer:

\textsf{\large{\underline{Solution}:}}

The given problem is solved using language - Python.

def f(x):

   new_list=[]

   for i in x:

       if i%2==0:

           new_list.append(i//2)

       else:

           new_list.append(i*2)

   return new_list

   

my_list=list(range(1,6))

print('Original List:',my_list)

my_list=f(my_list)

print('Modified List:',my_list)

\textsf{\large{\underline{Logic}:}}

  1. Create a new list.
  2. Iterate over the list passed into the function.
  3. Check if the element is even or not. If true, append half the value of element in the list.
  4. If false, append twice the value of the element in the list.
  5. At last, return the new list.

There is another way of doing this - By using map() function.

—————————————————————————————

def f(x):

   return list(map(lambda x:x//2 if x%2==0 else 2*x,x))

   

my_list=list(range(1,6))

print('Original List:',my_list)

my_list=f(2my_list)

print('Modified List:',my_list)

—————————————————————————————

\textsf{\large{\underline{O{u}tput}:}}

Original List: [1, 2, 3, 4, 5]

Modified List: [2, 1, 6, 2, 10]

You might be interested in
Which is the key benefit of using ram in a computer
Kryger [21]

Hey there!

The correct answer would be - Option B.

Hope this helps you!

3 0
3 years ago
WNOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOW
beks73 [17]

Answer:

yes.

Explanation:

7 0
2 years ago
The EDI ____________layer describes the business application that i
suter [353]

Answer:

a) EDI Semantic Layer

Explanation:

EDI is an acronym for electronic data interchange and it can be defined as a form of communication between interconnected computer systems and software applications with respect to business informations in standard digital formats.

This ultimately implies that, electronic data interchange (EDI) involves the transfer of business informations such as financial transactions between the computer systems of various organizations such as banks, companies, governmental agencies, etc. Thus, it avails businesses the ability to create strategic communications using computer to computer links to effectively and efficiently exchange business informations electronically or in digital formats.

Hence, the EDI Semantic layer describes the business application that is driving electronic data interchange (EDI).

6 0
2 years ago
You have just purchased a new USB drive that you want to use to troubleshoot the computers in your company as well as other netw
Masteriza [31]

Answer:

FAT32   is the correct answer to the given question        

Explanation:

FAT32 is a storage structure that is used for the purpose of the storage media. The main objective of the file system to manage the files on the hard drives, SSD, etc.

  • FAT32 is utilizing the 32-bit pieces of data for grouping of information in the hard disk.
  • The main advantage of the FAT32 file system it can format a USB drive that is recognized by all computer systems.
  • FAT32 is required less memory space on massive partitions of the hard disk.
8 0
3 years ago
Which of the following is NOT a reason to use cryptography?
Mars2501 [29]

Cryptography is not a reason to use when posting photos on a public social media website.

Cryptography is the use of certain techniques that help protect important and personal information from being accessed by other parties. This technological practice or method allows a person to send sensitive or personal information over the internet without risking any "leak" of information.

  • Cryptography literally means "hidden writing", which is what the method is all about.
  • It presents a safe and secure way of sending or passing information, even personal or sensitive ones.
  • This technological method enables businesses and other companies as well as individuals to procure and send information without fearing for any loss of their information.
  • Cryptography is mainly used in the military, secret operations, businesses, or even in maintaining one's passwords while using social media platforms or submitting a password on a website.
  • One reason to not use it is when posting photos on social media websites as the website is to be used by the web world and may/can be accessed by everyone around the world.

Cryptography not only allows a person to maintain certain privacy and security but also help the smooth functioning of businesses and other national security works. Thus, cryptography is the "security" of individuals in the 'internet world'.

Learn more about cryptography here:

brainly.com/question/88001

5 0
2 years ago
Read 2 more answers
Other questions:
  • Why is driving a privilege?
    15·2 answers
  • What does UDP stand for?
    12·2 answers
  • ___ are controls through which a user can enter input data in a gui application. answer
    10·1 answer
  • Websites whose URL’s contain tildes (~) are usually published by the government. TRUE or FALSE.
    8·2 answers
  • Brainliest for whoever adds me on snap<br> gianavaughn007
    15·2 answers
  • What is the google search operator that limits results to a specific domain?
    8·1 answer
  • For example, consider a file with protection mode 644 (octal) contained in a directory with protection mode 730. How might the f
    9·1 answer
  • ASAP BRAINLIEST!!!!!!
    5·2 answers
  • Please answer this question​
    6·1 answer
  • This isn't an academic question, but it's a question about something I am consistently seeing on Brainly, so please don't delete
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!