answer.
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
weqwewe [10]
1 year ago
11

A triangular number is a number that is the sum of the integers from 1 to some integer n. Thus 1 is a triangular number because

it's the sum of the integers from 1 to 1; 6 is a triangular number because it's 1+2+3=6. Given the non-negative integers m and n (with m < n), create a list of the triangular numbers between (and including) m and n. Thus if m is 3 and n is 20, the list would be: [3, 6, 10, 15]. Associate the list with the variable triangulars.
Computers and Technology
1 answer:
neonofarm [45]1 year ago
4 0

Answer:

  1. m = 3
  2. n = 20
  3. triList = []
  4. current = 0
  5. for i in range(1, n + 1):
  6.    current = current + i  
  7.    if(current >= m and current <= n):
  8.        triList.append(current)
  9. print(triList)

Explanation:

The solution code is written in Python 3.

Firstly, create variable m and n and set the value 3 and 20 to the variables (Line 1 -2)

Create a triangle number list (Line 4)  and another variable current to hold the value of current total of triangle number (Line 5).

Create a for loop and iterate through the number between m and n (Line 6).  Calculate the current total of triangle number (Line 7) and proceed to check if the current triangle number is bigger or equal to m and smaller and equal to n, add the current triangle number to triList (Line 8-9).

Print the triList (Line 11) and we shall get [3, 6, 10, 15]

You might be interested in
Server farms such as Google and Yahoo! provide enough compute capacity for the highest request rate of the day. Imagine that mos
EleoNora [17]

Answer:

a) Power saving = 26.7%

b) power saving = 48%

c) Power saving = 61%

d) Power saving = 25.3%

Explanation:

3 0
2 years ago
A(n) ______close to a cover letter leads to more interviews because you are contacting the employer. a. passive b. lengthy c. ac
kozerog [31]

Answer: c. active

An active close to a cover letter leads to more interviews, because you are contacting the employer. When creating a cover letter, you provide information about yourself and what your capabilities are, by having an active close to your cover letter, you're letting the reader know exactly what you want to do to help them with their endeavor. Having an active close will also allow the reader to get to know who you are and what you have to offer them.

7 0
1 year ago
Read 2 more answers
Garrett wants to search through a csv file to find all rows that have either the name John or Bob in them and display them out t
Olin [163]

Answer:

A.  grep -E "(John|Bob)" salesemployees.csv

Explanation:

The grep command is used to search text. It searches the given file for lines containing a match to the given strings or words.

How to use Grep Command:

grep 'letter' filename – Search any line that contains word 'letter' in filename on Linux

grep -i 'Alphabet' file1 – A case-insensitive search for the word ‘Alphabet’ in Linux and Unix

grep -R 'root' . – Search all files in the current directory and in all of its subdirectories in Linux for the word ‘root’

8 0
2 years ago
You would use the _______ conditional formatting options when analyzing a worksheet in which you want to highlight the highest o
nirvana33 [79]

Answer:

Top/bottom conditional formatting

Explanation:

The top/bottom conditional formatting automatically carries out the task of finding the highest, lowest and even average values.

Conditional formatting formatting gives one the opportunity to enhance reports and dashboards as they work on excel.

You use the too/bottom formatting to highlight cells whose values of highest in a dataset and lowest in a dataset

4 0
1 year ago
Create an application named SalesTransactionDemo that declares several SalesTransaction objects and displays their values and th
crimeas [40]

Answer:

Explanation:

The following code is all written in Java, first I will add the object initialization and declaration code that can be added to the main method of any program. Then I have also written the entire SalesTransaction class as the question was not clear as to exactly which was needed.

//Object Creation to copy and paste into main method

SalesTransaction sale1 = new SalesTransaction("Gabriel", 25, 5);

SalesTransaction sale2 = new SalesTransaction("Daniela", 5);

SalesTransaction sale3 = new SalesTransaction("Jorge");

//SalesTransaction class with three constructors

package sample;

class SalesTransaction {

   String name;

   int salesAmount, commission;

   private int commissionRate;

   public SalesTransaction(String name, int salesAmount, int rate) {

       this.name = name;

       this.salesAmount = salesAmount;

       this.commissionRate = rate;

       commission = salesAmount * rate;

   }

   public SalesTransaction(String name, int salesAmount) {

       this.name = name;

       this.salesAmount = salesAmount;

       this.commissionRate = 0;

   }

   public SalesTransaction(String name) {

       this.name = name;

       this.salesAmount = 0;

       this.commissionRate = 0;

   }

}

8 0
1 year ago
Other questions:
  • Discuss how the user-designer communications gap can cause a good project to go bad.
    8·1 answer
  • Which of the following would be a considered a want rather than a need for most people?
    15·1 answer
  • When driving, your attention is __________.
    5·2 answers
  • In a system containing CPU 1 and Disk Drive A, the system is instructed to access Track 1, Track 9, Track 1, and then Track 9 of
    12·1 answer
  • The Paste Options button labeled ____ is used if you want the pasted chart not to be linked to the source document but you want
    9·1 answer
  • You are the IT security administrator for a small corporate network. Samuel Garcia (sgarcia) has been away on vacation and has f
    9·1 answer
  • A ____ is a software implementation of a computer that executes programs as if it were a real physical computer within the physi
    15·1 answer
  • You are modeling a small part of an online flight reservation system, according to the following description. A flight is a sing
    11·1 answer
  • Exercise 3: Function Write a function named word_count that accepts a string as its parameter and returns the number of words in
    10·1 answer
  • In this question, you will experimentally verify the sensitivity of using a precise Pi to the accuracy of computing area. You ne
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!