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
Anuta_ua [19.1K]
3 years ago
14

Write Python algebraic expressions corresponding to the following statements: (a) The sum of the first five positive integers (b

) The average age of Sara (age 23), Mark (age 19), and Fatima (age 31) (c) The number of times 73 goes into 403 (d) The remainder when 403 is divided by 73 (e) 2 to the 10th power (f) The absolute value of the difference between Sara's height (54 inches) and Mark's height (57 inches) (g) The lowest price among the following prices: $34.99, $29.95, and $31.50
Computers and Technology
1 answer:
lbvjy [14]3 years ago
5 0

Answer:

#part a

#sum of first 5 positive number

Sum=5*(5+1)/2

print("sum of first 5 positive integer is: ",Sum)

#part b

# declare age of all

Sara_age=23

Mark_age=19

Fatima_age=31

ave_age=(Sara_age+Mark_age+Fatima_age)/3

print("average age of Sara,mark and Fatima is: ",ave_age)

#part c

#find number of times

no_of_times=int(403/73)

print(" number of times when 73 goes into 403 is: ",no_of_times)

#part d

#find remainder

rem=403%73

print("when 403 is divided by 73 then remainder  is: ",rem)

#part e

#calculate 2 to pawer 10

two_pow=2**10

print("2 to power  10 is: ",two_pow)

#part f

#declare height of both

sara_h=54

mark_h=57

diff_h=abs(sara_h-mark_h)

print("The absolute difference between height of Sara and Mark is: ",diff_h)

#part g

#find the minimum among three

print("lowest price among the three($34.99,$29.95,$31.50) is: $",min(34.99,29.95,31.50))

Explanation:

In part a, sum of first 5 positive number is calculated as 5*(5+1)/2.In part b, add the age of three and divide it  by 3. In part c, use "/" to find number of times 73 goes into 403.In part d, use "%" to find remainder when 403 is divide by 73.In part e, 2 to the 10th power is calculated as 2**10.In part f, use abs() to find the absolute  difference.In part g, min() function is used to find lowest among the 3 prices.

Output:

sum of first 5 positive integer is:  15.0                                                                                  

average age of Sara,mark and Fatima is:  24.333333333333332                                                                

number of times when 73 goes into 403 is:  5                                                                              

when 403 is divided by 73 then remainder  is:  38                                                                          

2 to power  10 is:  1024                                                                                                  

The absolute difference between height of Sara and Mark is:  3                                                            

lowest price among the three($34.99,$29.95,$31.50) is: $ 29.95

You might be interested in
Explain the difference between undecidable problems and unreasonable time algorithms. Be specific.
ddd [48]

One for which no algorithm can ever be written to find the solution is an unsolvable problem. An undecidable problem is one for which no algorithm can ever be written that will always provide any input value with a correct true/false option.

6 0
2 years ago
Write an algorithm (pseudo-code) that takes an unsorted list of n integers and outputs a sorted list of all duplicate integers.
nexus9112 [7]

Answer:

brainliest if it did help you

Explanation:

Given array : A[0...n-1]Now, create a count array Cnt[0...n-1]then, initialize Cnt to zero

for(i=0...n-1)

Cnt[i]=0 ---------O(n) time

Linearly traverse the list and increment the count of respected number in count array.

for(i=0...n-1)

Cnt[A[i]]++; ---------O(n) time

Check in the count array if duplicates exist.

for(i=0...n-1){

if(C[i]>1)

output (i); -----------O(n) time

}

analysis of the above algorithm:

Algorithm takes = O(1 + n + n + n)

                           = O(n)          

//java code

public class SortIntegers {

  public static void sort(int[] arr) {

    int min = arr[0];

    int max = arr[0];

    for (int i = 0; i < arr.length; ++i) {

      if (arr[i] > max) {

        max = arr[i];

      }

      if (arr[i] < min) {

        min = arr[i];

      }

    }

    int counts[] = new int[max - min + 1];

    for (int i = 0; i < arr.length; ++i) {

      counts[arr[i] - min]++;

    }

    for (int i = 0; i < counts.length; ++i) {

      if (counts[i] > 1) {

        System.out.print((i + min) + " ");

      }

    }

    

    System.out.println();

  }

  public static void main(String[] args) {

    sort(new int[] { 5, 4, 10, 2, 4, 10, 5, 3, 1 });

  }

}

7 0
2 years ago
A company is looking for an employee to help organize customer information for the sales team. Which computer field includes thi
slavikrds [6]

Answer:

A

Explanation:

security organises the customer's info online and in person for the sales team.

4 0
1 year ago
Read 2 more answers
What type of media is a hard disk​
anyanavicka [17]

Answer:

A hard disk provides a high-capacity alternative to magnetic storage media. It contains metal platters coated with a magnetic layer. The platters usually spin continuously when a computer is on, storing data in different sectors on the magnetic disk.

Explanation:

5 0
3 years ago
What is the viewport?
Shtirlitz [24]
C. The viewing area of a web browser.

The viewport is the user's visible area of a web page.
5 0
2 years ago
Other questions:
  • What are the features of Cobol language that make it suitable for programming business applications.
    6·1 answer
  • Click on the _____ tab on the ribbon to open the backstage view.
    7·1 answer
  • How can I make a website login system with only using php?​
    6·1 answer
  • Which of the following that can be use to access session variables in PHP?
    14·1 answer
  • Which of these statements regarding​ time-cost tradeoffs in CPM networks is​ true?
    6·1 answer
  • . How is using 0 / 1 or true / false in specifying digital an abstraction?
    11·1 answer
  • Select the correct answer from the drop-down menu.
    15·2 answers
  • Match each type of video camera to its features:
    15·1 answer
  • An operating system with _____ capabilities allows a user to run more than one program concurrently.
    6·1 answer
  • What plugs into this?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!