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]
2 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]2 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
What is the first thing you should do to find a mean and range of data?
KatRina [158]

Answer

To find mean of data add all the numbers in the set of data and divide the sum by the number of addends.

To find range, identify the difference between the highest value and lowest value in the set of data.

Explanation

Mean, mode, median and range are the primary measurements used to get the measures of central tendencies. To get the mean and range; first arrange the data in an ascending order, then identify the highest value and the lowest value in the set. The difference between these two data values gives the range of the set of values. For the mean, add all the set of values and then divide their sum with the number of values in the set of data.


6 0
3 years ago
Write a program with 2 separate functions which compute the GCD (Greatest Common Denominator) and the LCM (Lowest Common Multipl
Maru [420]

Answer:

The program written in Python is as follows

def GCD(num1, num2):

    small = num1

    if num1 > num2:

         small = num2

    for i in range(1, small+1):

         if((num1 % i == 0) and (num2 % i == 0)):

              gcd = i

    print("The GCD is "+ str(gcd))

def LCM(num1,num2):

    big = num2  

    if num1 > num2:

         big = num1

    while(True):

         if((big % num1 == 0) and (big % num2 == 0)):

              lcm = big

              break

         big = big+1

     print("The LCM is "+ str(lcm))

 print("Enter two numbers: ")

num1 = int(input(": "))

num2 = int(input(": "))

GCD(num1, num2)

LCM(num1, num2)

Explanation:

This line defines the GCD function

def GCD(num1, num2):

This line initializes variable small to num1

    small = num1

This line checks if num2 is less than num1, if yes: num2 is assigned to variable small

<em>     if num1 > num2: </em>

<em>          small = num2 </em>

The following iteration determines the GCD of num1 and num2

<em>     for i in range(1, small+1): </em>

<em>          if((num1 % i == 0) and (num2 % i == 0)): </em>

<em>               gcd = i </em>

This line prints the GCD

    print("The GCD is "+ str(gcd))

   

This line defines the LCM function

def LCM(num1,num2):

This line initializes variable big to num2

    big = num2  

This line checks if num1 is greater than num2, if yes: num1 is assigned to variable big

<em>     if num1 > num2: </em>

<em>          big = num1 </em>

The following iteration continues while the LCM has not been gotten.

    while(True):

This if statement determines the LCM using modulo operator

<em>          if((big % num1 == 0) and (big % num2 == 0)): </em>

<em>               lcm = big </em>

<em>               break </em>

<em>          big = big+1 </em>

This line prints the LCM of the two numbers

     print("The LCM is "+ str(lcm))

The main starts here

This line prompts user for two numbers

print("Enter two numbers: ")

The next two lines get user inputs

num1 = int(input(": "))

num2 = int(input(": "))

This calls the GCD function

GCD(num1, num2)

This calls the LCM function

LCM(num1, num2)

<em></em>

<em>See attachment for more structured program</em>

Download txt
5 0
2 years ago
If you were an architect planning on building a large scale Municipal complex what type of engineer would you identify as essent
Daniel [21]

Answer: civil engineer

Explanation:

Based on the information given, the type of engineer that would be identified as essential to the success of the project would be the civil engineer.

Civil engineers are the engineers that are in charge of the planning and overseeing building and infrastructure construction. They plan and monitor constructions involving bridges, road, houses, power plants etc.

3 0
2 years ago
What are the three aspects to consider when taking and critiquing photograph?
svlad2 [7]
The angle
Steady Hands
Focusing on the right lighting
3 0
2 years ago
1. Of Facebook, Twitter, and LinkedIn, which do you think is the best platform for marketing your personal brand? Explain.
lord [1]
Facebook cuz a lot more people on Facebook to see your personal brand
3 0
3 years ago
Other questions:
  • What is a data mining??
    5·1 answer
  • Which of the following was one of the first internet search engines? A. archie B. google C. Yahoo D.ask
    7·1 answer
  • Approximately what percent of desktop PCs are used for work-related purposes?
    12·1 answer
  • Using the _______ list, you can select the number of photos that will appear on each slide.
    13·1 answer
  • Jeremy wishes to create a site map for his website. What tag will surround the URL of his home page? A. B. C. D.
    8·1 answer
  • A red wavy line under a word means _____. a change has been made in the text a new word was inserted in the document there is a
    11·2 answers
  • You want to make the background of a Web page blue, click _____.
    13·2 answers
  • How to write email abut new home your friend ​
    14·1 answer
  • PLEASE HELP!
    14·2 answers
  • Usually it is a rectangular box placeed or underneath your desk​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!