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
harkovskaia [24]
3 years ago
9

Write a single statement that will print the message "first is " followed by the value of first, and then a space, followed by "

second = ", followed by the value of second. Print everything on one line and go to a new line after printing
Computers and Technology
1 answer:
Hatshy [7]3 years ago
4 0

Answer:

Statement:

print("first is "+str(first)+"  second = "+str(second)) # It is a python statement where first and second are variable of any type.

Explanation:

  • The above statement is the print statement that prints the value of first and second variables like in the form of "first is" value of the first variable, then space, then "second = b" and then the value of the second variable.
  • The value for the first and the second variable of any type but it convert it into string form with the help of str() function in the print statement.
  • The string of the print statement can be formed by the help '+' operator which adds the string with the value and the other string in print statement in java and python language.
You might be interested in
A frame size of 2048 × 1536.
Anon25 [30]
The answer is: 3,145,728 bytes
3 0
3 years ago
Read 2 more answers
In this exercise you will debug the code which has been provided in the starter file. The code is intended to take two strings,
vampirchik [111]

Answer:

Here is the corrected program:

import java.util.Scanner; //to accept input from user

public class 02_14_Activity_one { //class name

    public static void main(String[] args) { //start of main method

    Scanner scan = new Scanner(System.in); //creates Scanner class object

  System.out.println("Enter first string"); //prompts user to enter first string

          String s1 = scan.nextLine(); //reads input string from user

  System.out.println("Enter second string"); //prompts user to enter second string

          String s2 = scan.nextLine(); //reads second input string from user

    System.out.println("Enter number of letters from each word"); //enter n

          int n = scan.nextInt(); //reads value of integer n from user

          System.out.println(s1.substring(0,n) + s2.substring(s2.length() - n ));

         } } //uses substring method to print a string made up of the first n letters of s1 and the last n letters of s2.

Explanation:

The errors were:

1.

Scanner scan = Scanner(System.in);

Here new keyword is missing to create object scan of Scanner class.

Corrected statement:

 Scanner scan = new Scanner(System.in);

2.

String s1 = nextLine();  

Here object scan is missing to call nextLine() method of class Scanner

Corrected statement:

String s1 = scan.nextLine();

3.

String s2 = Scanner.nextLine();

Here class is used instead of its object scan to access the method nextLine

Corrected statement:

String s2 = scan.nextLine();

4.

String n = scan.nextLine();

Here n is of type String but n is a whole number so it should be of type int. Also the method nextInt will be used to scan and accept an integer value

Corrected statement:

int n = scan.nextInt();

5.

System.out.println(s1.substring(1,n-1) + s2.substring(s1.length()-n));

This statement is also not correct

Corrected statement:

System.out.println(s1.substring(0,n) + s2.substring(s2.length() - n ));

This works as follows:

s1.substring(0,n) uses substring method to return a new string that is a substring of this s1. The substring begins at the 0th index of s1 and extends to the character at index n.

s2.substring(s2.length() - n ) uses substring method to return a new string that is a substring of this s2. The substring then uses length() method to get the length of s2 and subtracts integer n from it and thus returns the last n characters of s2.

The screenshot of program along with its output is attached.

7 0
3 years ago
What does If you’re not paying for the product, you are the product.” mean
pochemuha

Answer:

it means your free

Explanation:

7 0
3 years ago
Modify your solution to Problem 8.24 so that one (and only one) child installs a Segmentation-fault handler which prints an erro
aksik [14]

/* Figure 8.18 */ #include "csapp.h" #define N 2 int main() int status, i; pid_t pid; /* Parent creates N children */ for (i = 0; i < N; i++) if ((pid = Fork ()) == 0) /* child */ exit(100+i); /* Parent reaps N children in no particular order */ while ((pid = waitpid(-1, &status, 0)) > 0) if (WIFEXITED (status) ) printf("child %d terminated normally with exit status=%d\n", pid, WEXITSTATUS (status)); else printf("child %d terminated abnormally\n", pid) ; /* The normal termination is if there are no more children */ if (errno != ECHILD) unix_error("waitpid error"); exit(0);

Hope this helps!

8 0
3 years ago
list the six external parts of a computer system, identify which is the output device and which is the input device?
Mariulka [41]
1.mouse input
2.keyboard input
3.monitor output
4.speakers output
5.printer output , and input if has scanner
5.microphone input
4 0
3 years ago
Read 2 more answers
Other questions:
  • In a PERT network, non-critical activities that have little slack need to be monitored closely
    14·1 answer
  • All of the following are ways to improve the mobile experience for a website visitor EXCEPT:
    8·1 answer
  • Write a program to solve the selection problem. Let k = N/2. Draw a table showing the running time of your program for various v
    12·1 answer
  • What is an input, output and storage device?
    12·1 answer
  • Why Is Jarvis Banned For Life? Literally Don't need to be forever!
    9·1 answer
  • You use_____ to view an XPS file
    6·1 answer
  • What is the diffrence between the the grassland and the savanna biomes
    11·2 answers
  • for java ?(Business: check ISBN-13)ISBN-13 is a new standard for identifying books. It uses 13 digits d1d2d3d4d5d6d7d8d9d10d11d1
    9·1 answer
  • What's the difference between cross-site scripting and cross-site request forgery? How do you protect against cross-site request
    15·1 answer
  • Which type of address is the ip address 232. 111. 255. 250?.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!