answer.
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
Ierofanga [76]
2 years ago
10

Let's revisit our lucky_number function. We want to change it, so that instead of printing the message, it returns the message.

This way, the calling line can print the message, or do something else with it if needed. Fill in the blanks to complete the code to make it work.
def lucky_number(name):
number = len(name) * 9
___ = "Hello " + name + ". Your lucky number is " + str(number)
___

print(lucky_number("Kay"))
print(lucky_number("Cameron"))
Computers and Technology
1 answer:
maksim [4K]2 years ago
3 0

Answer:

Replace the first blank with:

message = "Hello " + name + ". Your lucky number is " + str(number)

Replace the second blank with:

return message

Explanation:

The first blank needs to be filled with a variable; we can make use of any variable name as long as it follows the variable naming convention.

Having said that, I decided to make use of variable name "message", without the quotes

The next blank is meant to return the variable on the previous line;

Since the variable that was used is message, the next blank will be "return message", without the quotes

You might be interested in
Write a function in the cell below that iterates through the words in file_contents, removes punctuation, and counts the frequen
viktelen [127]

Answer:

Explanation:

The diagrams attached to the questions are shown in the first and the second image below. The first image shows the code and the second image shows the error  that appears at the moment of running it.

To answer that ; We will notice that the error in the second image is what it says; what happened is that the individual subject performing this action is trying to to open the file called "h.txt", but the python interpreter is unable to find the file. The individual subject will need to have h.txt inside your current working directory for python to open it.

From the third image attached ; I have careful attached an image that illustrate how you can add the file by going to file →  open (right from your jupyter notebook). Afterwards you can either upload the file, or create a new text file and paste the contents on it as displayed in the fourth image attached in the diagram below.

4 0
1 year ago
Select the correct answer. Richard owns a chain of hardware stores. He wants to update the store website and write a numbered li
olga_2 [115]
What’s the answer choices ?
3 0
2 years ago
Robin wants her presentation to move from one slide to another with special motion effects. Which option should Robin use?
topjm [15]
If this is in power point, then she should use the <em>transitions </em>tab on the ribbon. =)
3 0
2 years ago
Read 2 more answers
Find a 95% confidence interval for the mean failure pressure for this type of roof panel.The article "Wind-Uplift Capacity of Re
aliya0001 [1]

Answer:

The 95% confidence interval would be given by (2.351;3.525)    

Explanation:

1) Previous concepts

A confidence interval is "a range of values that’s likely to include a population value with a certain degree of confidence. It is often expressed a % whereby a population means lies between an upper and lower interval".

The margin of error is the range of values below and above the sample statistic in a confidence interval.

Normal distribution, is a "probability distribution that is symmetric about the mean, showing that data near the mean are more frequent in occurrence than data far from the mean".

\bar X represent the sample mean  

\mu population mean (variable of interest)

s represent the sample standard deviation

n represent the sample size  

2) Confidence interval

The confidence interval for the mean is given by the following formula:

\bar X \pm t_{\alpha/2}\frac{s}{\sqrt{n}}   (1)

In order to calculate the mean and the sample deviation we can use the following formulas:  

\bar X= \sum_{i=1}^n \frac{x_i}{n} (2)  

s=\sqrt{\frac{\sum_{i=1}^n (x_i-\bar X)}{n-1}} (3)  

The mean calculated for this case is \bar X=2.938

The sample deviation calculated s=0.472

In order to calculate the critical value t_{\alpha/2} we need to find first the degrees of freedom, given by:

df=n-1=5-1=4

Since the Confidence is 0.95 or 95%, the value of \alpha=0.05 and \alpha/2 =0.025, and we can use excel, a calculator or a table to find the critical value. The excel command would be: "=-T.INV(0.025,4)".And we see that t_{\alpha/2}=2.78

Now we have everything in order to replace into formula (1):

2.938-2.78\frac{0.472}{\sqrt{5}}=2.351    

2.938+2.78\frac{0.472}{\sqrt{5}}=3.525    

So on this case the 95% confidence interval would be given by (2.351;3.525)    

5 0
1 year ago
You are responsible for a rail convoy of goods consisting of several boxcars. You start the train and after a few minutes you re
maks197457 [2]

Answer:

The program in C++ is as follows:

#include <iostream>

#include <iomanip>

using namespace std;

int main(){

   int cars;

   cin>>cars;

   double weights[cars];

   double total = 0;

   for(int i = 0; i<cars;i++){

       cin>>weights[i];

       total+=weights[i];    }

   double avg = total/cars;

   for(int i = 0; i<cars;i++){

       cout<<fixed<<setprecision(1)<<avg-weights[i]<<endl;    }

   return 0;

}

Explanation:

This declares the number of cars as integers

   int cars;

This gets input for the number of cars

   cin>>cars;

This declares the weight of the cars as an array of double datatype

   double weights[cars];

This initializes the total weights to 0

   double total = 0;

This iterates through the number of cars

   for(int i = 0; i<cars;i++){

This gets input for each weight

       cin>>weights[i];

This adds up the total weight

       total+=weights[i];    }

This calculates the average weights

   double avg = total/cars;

This iterates through the number of cars

   for(int i = 0; i<cars;i++){

This prints how much weight to be added or subtracted

       cout<<fixed<<setprecision(1)<<avg-weights[i]<<endl;    }

4 0
1 year ago
Other questions:
  • How efficient would a 6-bit code be in asynchronous transmission if it had 1 parity bit, 1 start bit, and 2 stop bits?
    5·1 answer
  • Splunk uses ________ to categorize the type of data being indexed..
    11·2 answers
  • If a user was complaining about a "slow computer" due to a program that uses a significant amount of memory, what part or parts
    15·1 answer
  • Define a function PyramidVolume with double parameters baseLength, baseWidth, and pyramidHeight, that returns as a double the vo
    7·2 answers
  • Consider the following relationship involving two entities, students and classes:A student can take many classes. A class can be
    9·1 answer
  • A contact list is a place where you can store a specific contact with other associated information such as a phone number, email
    9·1 answer
  • Write a method that takes three numerical String values and sums their values.
    14·2 answers
  • Jen is trying to discover if a motor has failed windings. What sort of test can she do.
    6·1 answer
  • g 18.6 [Contest 6 - 07/10] Reverse an array Reversing an array is a common task. One approach copies to a second array in revers
    8·1 answer
  • Declare a struct named PatientData that contains two integer data members named heightInches and weightPounds. Sample output for
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!