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
Jane is a postproduction crewmember for a film. Her responsibilities include arranging all the scenes that have been shot into t
navik [9.2K]
Jane is the editor of the film.
7 0
3 years ago
If person A creates an image with a creative common license. Person B then uses the image on his website. Who own the image and
Rudik [331]
Person A, of course. This person is the original maker of the image therefore that person has the rights to that image, person B does not automatically become the owner just by using it on his website. So the answer is person A.
3 0
2 years ago
The part of the computer that provides access to the internet is the
mariarad [96]

Answer:

The Answer B Modem

Explanation:

That is the only way that you want connect to the internet no other part can connect.

Unless you use a ethernet.

Please rate and heart.

thank you for posting this question i am glad i could answer it.

Please make this a brianliest answer thank you.

7 0
2 years ago
Create a file using any word processing program or text editor. Write an application that displays the files, name, containing f
MArishka [77]

Answer:

below is a Shell I have ;

1.Import java.nio.file.*;

2.Import java.nio.file attribute.*;

3.Import java.10 Exception;

4.public class FileStatistics

5.{

6.public static void main(string []args)

7.{

8.path file=

9.

paths.get("C:\\Java\\chapter.13\\TestData.txt")

10.try

11.{

12.\\declare count and then display path, file, name and folder name.

13.

14.

15.

16.\\declare a BasicFileAttributes object, then add statements to display the file's size and creation time.

17.

18.}

19.

20.catch (10 Exception e)

21.{

22.\\add display 10 Exception

23.

24.}

25.}

4 0
2 years ago
Which option can be used to access more settings than are available in the Backstage view?
Bumek [7]

Answer:

orientation settings

Explanation:

so u can now more about whta u doing

6 0
2 years ago
Other questions:
  • Suppose an array with six rows and eight columns is stored in row major order starting at address 20 (base 10). If each entry in
    8·1 answer
  • The part of the computer that contains the brain, or central processing unit, is also known as the A. monitor. B. keyboard. C. m
    13·2 answers
  • How do you get 99 points on sunny meadows simulation?
    6·2 answers
  • What i have to care about transmitting data packet from one controller to other controller?
    8·1 answer
  • Write a statement that adds 1 to the variable reverseDrivers if the variable speed is less than 0,adds 1 to the variable parkedD
    14·1 answer
  • What is 450 g of flour a measure of?
    11·1 answer
  • You recently upgraded your computer and added an extra 512 MB of RAM. Consequently, you want to increase your swap space by addi
    10·1 answer
  • In the Microsoft Excel spreadsheet how many choices are possible when using a single IF statement​
    9·1 answer
  • What can be done to solve unemployment problem?​
    11·1 answer
  • What are the minimum number of bits an address bus must have in a byte addressable memory system containing only 4 KiB of memory
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!