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
AfilCa [17]
3 years ago
9

Write the definition of a function named printpoweroftwostars that receives a non-negative integer n and prints a line consistin

g of "2 to the n" asterisks. so, if the function received 4 it would print 2 to the 4 asterisks, that is, 16 asterisks: **************** and if it received 0 it would print 2 to the 0 (i.e. 1) asterisks: * the function must not use a loop of any kind (for, while, do-while) to accomplish its job
Computers and Technology
1 answer:
Aleksandr-060686 [28]3 years ago
4 0
To accomplish this without using a loop,
we can use math on a string.

Example:
print("apple" * 8)

Output:
appleappleappleappleappleappleappleapple

In this example,
the multiplication by 8 actually creates 8 copies of the string.

So that's the type of logic we want to apply to our problem.

<span>def powersOfTwo(number):
if number >= 0:
return print("*" * 2**number)
else:
<span>return

Hmm I can't make indentations in this box,
so it's doesn't format correctly.
Hopefully you get the idea though.

We're taking the string containing an asterisk and copying it 2^(number) times.

Beyond that you will need to call the function below.
Test it with some different values.

powersOfTwo(4) should print 2^4 asterisks: ****************</span></span>
You might be interested in
Erik is the president and owner of Watch Out, a local website development company that helps clients create and build unique web
11111nata11111 [884]

Answer:

A. Source code

Explanation:

In the field of Programming; Source code is the code written in high level language given to the computer to translate to machine -  executable code before executing. It is usually written and understood by human. It is closer to human like language, as it allows easier expression. It is mostly consist of english-like statement.

So, Erik would primarily be writing source code when performing his daily tasks since his daily task require high level of computer programming and internet knowledge.

5 0
3 years ago
Write an if else statement that assigns 0 to the variable b and assigns 1 to the variable c if the variable a is less than 10. O
brilliants [131]

Answer:

if(a < 10)

{ b = 0; c = 1;}

else

{ b = -99; c = 0;}

Explanation:

4 0
3 years ago
Which component of service-oriented DSS can be defined as data that describes the meaning and structure of business data, as wel
Licemer1 [7]

Answer:

The correct answer to the following question will be Metadata Management.

Explanation:

The management of data about the other data is known as Metadata Management. When the data is generated, updated, deleted, created, metadata is generated.

Benefits of Metadata management:

  • To locate data for a person, the metadata management make it easier.
  • Project delivery become faster.
  • Maintain information of organization.

Hence, the Metadata Management will be the best suitable component which defined as the structure and meaning of business data.

4 0
3 years ago
In programming, what is a string?
Alla [95]

A way to store a sequence of letters, numbers or symbols.

This is the most accurate statement, though not entirely true.

Hope this helps.

7 0
3 years ago
Read 2 more answers
My HTC Desire 510's mobile data stopped working, how to I make it work again?
denis-greek [22]
Ask your mobile operator
2.go to hrs service
3. Turn on and turn off
4 0
3 years ago
Other questions:
  • If you are trying to create a web page for your band and having difficulty creating links to other groups on your page, what is
    7·1 answer
  • Which of the following is a goal of paraphrasing​
    12·1 answer
  • Can someone help me with...A table can help? PLEASE
    8·1 answer
  • A ____ operating system should be capable of supporting the applications and tools necessary to support Internet operations.
    10·1 answer
  • Which of the following is a typical concern for developers while using prototypes?
    6·2 answers
  • What is the advantage of defining a target user?
    6·1 answer
  • A hotel salesperson enters sales in a text file. Each line contains the following, separated by semicolons: The name of the clie
    11·1 answer
  • Help with this please anyone
    15·2 answers
  • Only for study<br><br>Or open Meet and enter this code: bqa-ivfs-ach​
    11·2 answers
  • Write a program named as reverse.c that reads a message, then prints the reversal of the message. The output of the program shou
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!