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
Mariana [72]
3 years ago
12

A Python programmer is writing a function definition. What syntax should be used?

Computers and Technology
2 answers:
rewona [7]3 years ago
7 0

Answer:

def functionName( arguments ):

statement1

statement2

statement3

Explanation:

Ber [7]3 years ago
6 0

Answer:

Python - Functions

Advertisements

A function is a block of orgaof code that is used to perform a single, related action. Functions provide better modularity for your application and a high degree ofAdvertisement

As you already know, Python gives you many built-in functions like print(), etc. but you can also create your own functions. These functions are called user-defined functions.

Defining a Function

You can define functions to provide the required functionality. Here are simple rules to define a function in Python.

Function blocks begin with the keyword def followed by the function name and parentheses ( ( ) ).

Any input parameters or arguments should be placed within these parentheses. You can also define parameters inside these parentheses.

The first statement of a function can be an optional statement - the documentation string of the function or docstring.

The code block within every function starts with a colon (:) and is indented.

The statement return [expression] exits a function, optionally passing back an expression to the caller. A return statement with no arguments is the same as return None.

You might be interested in
What does digital mean, in the term of computer science.
mote1985 [20]

Answer:

Digital describes electronic technology that generates, stores, and processes data in terms of two states: positive and non-positive.

Explanation:

5 0
3 years ago
Write the definition of a function named printpoweroftwostars that receives a non-negative integer n and prints a line consistin
Aleksandr-060686 [28]
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>
4 0
4 years ago
An attacker has hidden an NFC reader behind an NFC-based kiosk in an airport. The attacker uses the device to capture NFC data i
tatiyna

Answer:

Nfc relay attack

Explanation:

The NFC relay attack occurs when data is extracted by an attacker who puts himself in the middle of two parties having a communication with each other. As the message gets to a party, the attacker gets it and modifies it to their taste then passes it on.

This attacker in this question is extracting data by establishing communication between end user devices and reader in the kiosk

5 0
3 years ago
One group of students did an experiment to study the movement of ocean water. The steps of the experiment are listed below.
dsp73

The lamp and the ice bag were at the same place.  
Sounds like the experiment was intended to show on a small scale ocean currents from the poles to the equator and back to the poles. The bag of ice would simulate the cold at the poles while the lamp would simulate the heat provided by the sun near the equator. With that in mind, let's look at the possible flaws and see what is likely.  
Not enough ink was added.
 * If you can see the ink, then there's enough ink. So this isn't the correct choice.  
Not enough water was taken.
 * Possibility there wasn't enough volume of water to setup a current, but not too likely since the baking dish was filled. So let's look further. 
 The dish was too small for the experiment.
 * Same as above. It might be this, but there's something more likely. 
 The lamp and the ice bag were at the same place.
 * This sounds like a winner. In the real world, the poles are cold and the equator gets more sunlight. So there's a temperature gradient. In the described setup, both the heat sink (the bag of ice) and the heat source (the lamp) were at the same location.
5 0
3 years ago
What are building blocks? select three options.
mr Goodwill [35]

Answer:

Content that has been formatted

Content that is stored as templates

Content that is stored in galleries

Explanation:

These are the answers because that’s just what they are

7 0
4 years ago
Other questions:
  • Almost all PCs have this type of serial connector
    8·1 answer
  • If you delete a view, account administrators can recover the view using the "trash can" function within how many days?
    7·2 answers
  • Why are laptops usually more expensive than desktop computers with comparable power and features?
    10·1 answer
  • 14. You can store data copied from any Office application file with the
    14·1 answer
  • Plato: A university wants to install a client-server network. Which feature do you think is important for them as they set up th
    5·1 answer
  • Is number 1 correct​
    7·2 answers
  • Select four tasks associated with operating system maintenance. Cleaning inside the computer Defragmenting the hard drive Deleti
    11·1 answer
  • Please help, you don’t have to answer it i just need to know the best types of conversions
    12·1 answer
  • PLEASE SOMEONE PLEASE HELP ME OUT!!!!
    10·2 answers
  • Write, compile, and test the MovieQuoteInfo class so that it displays your favorite movie quote, the movie it comes from, the ch
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!