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
AysviL
2 months 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:
oksian1 [950]2 months ago
3 0

Answer:

Fill in the first blank with:

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

Fill in the second blank with:

return message

Explanation:

The first blank must be completed with a variable, and any variable name can be chosen as long as it adheres to naming conventions.

For this instance, I have chosen the variable name "message", without including quotes.

For the next blank, it should return the variable defined in the line above;

Thus, the appropriate completion for this blank will be "return message", without the quotes.

You might be interested in
Suppose that a scheduling algorithm (at the level of short-term CPU scheduling) favors those processes that have used the least
Harlamova29_29 [1022]

Answer:

The response to the question is:

I/O-bound

programs do not heavily rely on CPU time, typically experiencing brief CPU bursts.

In contrast, CPU-bound programs need extensive CPU bursts. Starvation is not a concern for CPU-bound processes since I/O-bound programs conclude their execution more rapidly, frequently allowing CPU-bound programs access to the CPU.

Explanation:

I/O-bound threads usually experience tight latencies, which must be compared against computer-bound threads during Windows tasks.

For instance, a mouse click elicits a quick response, unlike a batch job that operates in the background.

If the process is slower, a user may change operating systems, and server workloads tend to disregard UI responsiveness.

8 0
1 month ago
A wireless network was recently installed in a coffee shop and customer mobile devices are not receiving network configuration i
Rzqust [1037]

Response:

ensure the DHCP server is operational

Clarification:

5 0
28 days ago
A router has a valid operating system and a configuration file stored in nvram. the configuration file contains an enable secret
oksian1 [950]
The mode displayed is user EXEC mode. This mode is utilized for configuring, observing, and testing system processes. Typically, user EXEC commands allow connection to remote devices, temporary modification of terminal line settings, conducting basic tests, and displaying system details. This mode is commonly accessed by standard system admins, while privileged EXEC mode is reserved for the root administrator. Switch between these two levels using the enable and disable commands. A valid password is required to access the user-level EXEC command line.
8 0
26 days ago
What feature would be used to collect how many times users downloaded a product catalog?
ivann1987 [1066]
Event Tracking is an important capability within Google Analytics used to capture user interactions with various website elements.
8 0
25 days ago
Write a program using the standard library I/O functions (fopen, fread, fwrite, fclose, ferror, feof, and fflush) to read a text
amid [951]

Answer:

Refer to the explanation

Explanation:

#include <stdio.h>

#include <stdlib.h>

#include<string.h>

int main(int argc, char *argv[])

{

FILE *fr,*fr1,*fr3; /* declare the file pointer */

char filename[256];

char search[256];

char line[256];

int count=0;

char replace[256];

printf("Enter FileName: "); // ask for filename

scanf("%s",filename);

fr3 = fopen (filename, "r");

if(ferror(fr3)) //check for any error assosicated to file

{

fprintf(stderr, "Error in file"); // print error in stderr

printf("Error");

}

printf("Input file data is");

while(!feof(fr3)) // checking end of file condition

{ //printf("inside");

fgets(line,256,fr3);

printf("%s",line);

}

printf("\nEnter String to search: "); //ask for string to search

scanf("%s",search);

printf("Enter string with whom you want to replace: "); //ask for string with whom you want to replace one time

scanf("%s",replace);

fr = fopen (filename, "r"); // open first file in read mode

fr1 = fopen ("output.txt", "w"); //open second file in write mode

if(ferror(fr)) //check for any error assosicated to file

{

fprintf(stderr, "Error in file"); // print error in stderr

printf("Error");

}

while(!feof(fr)) // checking end of file condition

{ //printf("inside");

fgets(line,256,fr);

int r=stringCompare(line,search); // comparing every string and search string

// printf("%d",r);

if(r==1 && count==0)

{

fwrite(replace, 1, sizeof(replace), fr1 ); // writing string to file.

printf("%s\n",replace);

count++;

}

else{

printf("%s",line);

fwrite(line, 1, sizeof(line), fr1 );

}}

printf("\n");

fflush(fr1); // it will flush any unwanted string in stream buffer

fflush(fr);

fflush(fr3);

fclose(fr); //closing file after processing. It is important step

fclose(fr1);

fclose(fr3);

system("PAUSE");

return 0;

}

// Compare method which is comparing charaacter by character

int stringCompare(char str1[],char str2[]){

int i=0,flag=0;

while(str1[i]!='\0' && str2[i]!='\0'){

if(str1[i]!=str2[i]){

flag=1;

break;

}

i++;

}

if (flag==0 && (str1[i]=='\0' || str2[i]=='\0'))

return 1;

else

return 0;

}

7 0
21 day ago
Other questions:
  • In the Scrum board, prioritizing the issue backlog is done in the ———- mode.
    7·1 answer
  • Which of the following is true of how computers represent numbers?
    9·2 answers
  • Edhesive 2.3 code practice question 1​
    11·1 answer
  • Splunk In most production environments, _______ will be used as the source of data input?
    12·1 answer
  • 1. Orthographic Drawings are used to express ideas that are more complicated. Explain the purpose of the different views and the
    7·1 answer
  • Which of the following is true? a. Pseudocode is used to describe an algorithm. b. Pseudocode is not an actual computer programm
    11·1 answer
  • Assign max_sum with the greater of num_a and num_b, PLUS the greater of num_y and num_z. Use just one statement. Hint: Call find
    5·1 answer
  • In a survey of 7200 T.V. viewers, 40% said they watch network news programs. Find the margin of error for this survey if we want
    6·1 answer
  • HELP ME ON THIS PLEASE ILL GIVE BRAINLY!!!! If U GET IT RIGHT !!!
    10·1 answer
  • Write a program that calculates an adult's fat-burning heart rate, which is 70% of 220 minus the person's age. Complete fat_burn
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!