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
jenyasd209 [6]
2 years ago
10

Write the function powersOf3ToN(n) that takes a possibly-negative float or int n, and returns a list of the positive powers of 3

up to and including n. As an example, powersOf3ToN(10.5) returns [1, 3, 9]. If no such powers of 3 exist, you should return the empty list. You may not use loops/iteration in this problem.
Computers and Technology
1 answer:
Paha777 [63]2 years ago
4 0

Answer:

def powersOf3ToN(n):

   try:

       num = int(round(n))

   except (ValueError, NameError, TypeError):

       print("Parameter of the function must be integer or float")

       quit()

   num_list = range(num)

   val_list = [pow(3,x) for x in num_list if pow(3,x) in num_list]

   print(val_list)

powersOf3ToN(30)

Explanation:

The python code prints out a list of integer numbers that are equivalent to the power of three. The function accepts integer and floating numbers but not strings or it prints an error message and quits the program.

You might be interested in
Identify the correct XHTML syntax for inserting an image as a hyperlink from the options provided. A. book.gif B. C. D.
mariarad [96]

Answer:

The Correct syntax for inserting an image as hyperlink is given in explanation section

Explanation:

To make an image act as a hyperlink, place the image element within the HTML anchor "<a></a>"  element.

The syntax of inserting image hyperlink in XHTML is given below.

<a href = "link_that_can_be_accessible"><img src="source of image" alt="display name if image not shown in the browser" border="0"/></a>

for example lets insert image as hyperlink

<a href="ajax.html"><img src="logo.gif" alt="AJAX" border="0" /></a>

The default appearance is a blue border around the image. Specifying border="0" removes the border around the image.

if you want to insert image from another folder then the image hyperlink looks like this:

<a href="ajax.html"><img src="/images/html5/logo.gif" alt="AJAX" border="0" /></a>

If you want to insert image from another server then image hyper link looks like this:

<a href="ajax.html"><img src="https://www.myExample.com/images/html5/logo.gif" alt="AJAX" border="0" /></a>

4 0
3 years ago
Write a function to sum the following series:
Phoenix [80]

Answer:

<u>C program to find the sum of the series( 1/2 + 2/3 + ... + i/i+1)</u>

#include <stdio.h>

double m(int i);//function declaration  

//driver function

int main() {

int i;

printf("Enter number of item in the series-\n");//Taking input from user

scanf("%d",&i);

double a= m(i);//Calling function

printf("sum=%lf",a);

return 0;

}

double m(int i)//Defining function

{

double j,k;

double sum=0;

for(j=1;j<i+1;j++)//Loop for the sum

{

k=j+1;

sum=sum+(j/k);

}

return sum;

}

<u>Output:</u>

Enter number of item in the series-5

sum=3.550000

5 0
2 years ago
Pls help :( I am a radio and audio production student. What are two examples of a complex wave?
Brilliant_brown [7]

Answer:

A complex wave is a wave made up of a series of sine waves; it is therefore more complex than a single pure sine wave. This series of sine waves always contains a wave called the "FUNDAMENTAL", that has the same FREQUENCY (repetition rate) as the COMPLEX WAVE being created.

Examples for complex wave:

<em>• The Square wave </em>

<em>• The Triangular wave </em>

<em>• The Saw-tooth wave</em>

<em />

<em>Hope you got it </em>

<em> If you have any question just ask me </em>

<em>If you think this is the best answer please mark me as brainliest</em>

4 0
3 years ago
PLEASE HELP PROGRAMMING WILL GIVE BRAINLIEST
AveGali [126]

Answer:

I think it the answer will be 0,1,2,3,4

Explanation:

7 0
3 years ago
Read 2 more answers
What are the 5 characteristics of flowchart<br>​
olchik [2.2K]

Answer:

Here's ur answer

Explanation:

(i) Should consist of standardized and acceptable symbols. (ii) The symbols should be correctly used according to flowcharts rules. (iii) Should have short, clear and readable statements written inside the symbols. (iv) It must have clear one starting point and one ending point.

3 0
3 years ago
Other questions:
  • Which of the following are types of formatting you
    12·2 answers
  • The brainly home page uses about 112% of my cpu. (On chromebook) any ideas to help increase performance?
    7·2 answers
  • A user has been given Full Control permission to a shared folder. The user has been given Modify permission at the NTFS level to
    11·1 answer
  • The following algorithm should output the t times table in the format:
    6·1 answer
  • my airpods just do not seem to connect if i try to pair them, reset them, they have this continuous green light, please help me
    12·1 answer
  • 1)Create a conditional expression that evaluates to string "negative" if userVal is less than 0, and "positive" otherwise. Examp
    15·2 answers
  • What are the benefits of building redundancy into a network?
    12·1 answer
  • 01110101<br> +00100100<br> 00010001
    8·1 answer
  • Multiple Select Which of these are ways a hacker might learn someone's password? Select 3 options. o social engineering keylogge
    12·1 answer
  • What should a pie chart represent?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!