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
ycow [4]
3 years ago
7

Write a list comprehension statement to generate a list of all pairs of odd posi

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

Answer:

Print([(a,b) for a in range(10) for b in range(10) if (a < b and a%2 == 1 and b%2 == 1)])

Explanation:

Here, we declared a range of value for a and b using a for loop and the range function. The values are the first 10 numeric digits. The we used the if statement to establish our constraints;

In other to ensure that ;

Lower digit is written first ; (a < b) ;

Only odd numbers are considered,

a%2 == 1 ; b%2 == 1 (remainder when a and b are divided by 2 is 1.

Both a and b are declared as a tuple in other to obtain a pair of odd values.

You might be interested in
match the parts of a project plan listed in Column A to the specific examples given in Column B.Write the letter of your answer
prisoha [69]

Answer:

  1. The name of the project is    C: Reversible Playmat
  2. The objectives are given in B
  3. The Sketch is given as D
  4. The Materials needed is listed in A
  5. The procedure is F
  6. Evaluation is E

Explanation:

You would find that the other matches are relatively easy save for B and F. The difference between the procedure is that the procedure is more detailed about what needs to be done.

Notice that F states exactly, the dimensions that need to be cut while B albeit wordier, gives a description of the end result only.

Cheers.

7 0
3 years ago
Define an iterative function named append_ordered; it is passed two arguments: a linked list (ll) whose values are ordered from
enot [183]

Answer:

A python programming language (code) was used for this exercise.

The code is shown below in the explanation section

Explanation:

Solution

Python code:

class LN:

def __init__(self,value,next=None):

self.value = value

self.next = next

  def list_to_ll(self,l):

if l == []:

return None

front = rear = LN(l[0])

for v in l[1:]:

rear.next = LN(v)

rear = rear.next

return front

  def str_ll(self,ll):

answer = ''

while ll != None:

answer += str(ll.value)+'->'

ll = ll.next

return answer + 'None'

def append_ordered(self,ll,v):

ln1=LN(v); #create a node with the new value by creating an instance of the LN class

if ll is None: #if the linked list is empty

ll=ln1 #return the new created node

elif(ll.value >= ln1.value): #if the value to be add is smallest, append the linked list to it

ln1.next=ll

ll=ln1

else:

current=ll; #crate a temporary pointer to iterate over linked list

#iterate till the next node value is smaller than the new value and list is not over

while (current.next is not None and current.next.value < ln1.value):

current=current.next

ln1.next=current.next #save the current node in the next of the new node

current.next=ln1 #save new node in the next of current node

return ll

ln=LN(0); #create an instance of class LN

ll1=ln.list_to_ll([1,2,4,5]); #create a linked list of the list

answer=ln.str_ll(ll1);    

print(answer); #print the linked list

ll2=ln.append_ordered(ll1,3); #append the value 3 in the linked list

answer=ln.str_ll(ll2)

print(answer); #print the new linked list

Now,

  • If Linked list is empty then make the node as head and return it.
  • If value of the node to be inserted is smaller than value of head node, then insert the node at start and make it head.
  • In a loop, find the appropriate node after which the input node ( 10 ) is to be inserted.To find the appropriate node start from head,keep moving until you reach a node GN (12 ) who's value is greater than the input node. The node just before GN is the appropriate node (8).
  • Insert the node (10) after the appropriate node (8) found in step 3.

Note: Kindly find the output python code attached to the question below.

3 0
3 years ago
Who invented the collodian process
pentagon [3]
Frederick Scott Archer
5 0
3 years ago
Read 2 more answers
Why is wearable technology important?
BaLLatris [955]
If you are in war, Wearable Technology would provide Night Vision which would spot Hostile Soldiers in forests or in the dark.
8 0
3 years ago
Another personal question- are there any messaging sites that MIGHT work if most things are blocked via the school? I doubt anyt
noname [10]

Answer:

sort of

Explanation:

all the sites that allow you to message other people, even bots ,are all blocked , if youre trying to talk to a friend try sharing a google doc

8 0
3 years ago
Read 2 more answers
Other questions:
  • Welcome to Cypres...
    6·1 answer
  • One of the main purposes of special effects is to accomplish shots that would be too expensive, too dangerous or just plain impo
    9·2 answers
  • Why do the holes at the top of parachutes make it go slower
    12·1 answer
  • A process is: An activity of a function that is performed for some specific business reason A single piece of data within a syst
    14·1 answer
  • How are natural systems and engineered systems similar to one another?
    8·1 answer
  • How can you prevent your VMs receiving DHCP server messages from unauthorized virtual machine pretending to be DHCP servers?
    13·1 answer
  • An IT professional with a customer-service
    13·1 answer
  • A company has a website that has seen a large increase in visitors and they are concerned that if the trend continues, the web s
    13·1 answer
  • Limited time only for christmas give yourself free 100 points YES YES yes yes yes
    6·2 answers
  • software that opens files and scans their code to look for certain types of malware is known as software.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!