Take two String inputs of the same length and merge these by taking one character from each String (starting with the first entered) and alternating. If the Strings are not the same length, the program should print "error".

Sample Run 1:

Enter Strings:
balloon
atrophy
baatlrloopohny
Sample Run 2:

Enter Strings:
terrible
mistake
error

Answers

Answer 1

Answer:

Written in Python

print("Enter strings: ")

str1 = input()

str2 = input()

if len(str1) == len(str2):

     for i in range(0,len(str1)):

           print(str1[i]+str2[i], end='')

else:

     print("Error")

Explanation:

Prompts user for two strings

print("Enter strings: ")

The next two lines get the input strings

str1 = input()

str2 = input()

The following if condition checks if length of both strings are the same

if len(str1) == len(str2):

If yes, this iterates through both strings

     for i in range(0,len(str1)):

This prints the the characters of both strings, one character at a time

           print(str1[i]+str2[i], end='')

If their lengths are not equal, the else condition is executed

else:

     print("Error")

Answer 2

import java.util.Scanner;

public class JavaApplication89 {

   

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Enter Strings:");

       String word1 = scan.nextLine();

       String word2 = scan.nextLine();

       String newWord = "";

       if (word1.length() != word2.length()){

           newWord = "error";

       }

       else{

           for(int i = 0; i < word1.length(); i++){

               newWord += word1.charAt(i)+""+word2.charAt(i);

           }

       }

       System.out.println(newWord);

   }

   

}

This is the java solution. I hope this helps!


Related Questions

You are doing a multimedia presentation on World War I, and you want to use a visual aid to show the battle areas. What visual aid is best suited for this purpose?

Answers

Answer:

You are doing a multimedia presentation on World War I, and you want to use a visual aid to show the battle areas. What visual aid is best suited for this purpose?

Explanation: it is a map.

The visual aid that will be good for the multimedia presentation is a map.

Visual aids are simply referred to as items of a visual manner like graphs, maps, video clips, etc that are used in addition to spoken information.

In this case, since the individual is doing a multimedia presentation on World War I, and wants to use a visual aid to show the battle areas, a map will be the appropriate visual aid to use in this case.

Read related link on:

https://brainly.com/question/3198345

Which actions are essential to active participation? Check all that apply.
taking control
coming prepared
being focused
keeping quiet
assisting others
asking questions

Answers

Answer:

the answer are B,C,E,F

Explanation:

i just got it right :)

hope this helps ;)

Answer:

b c e f is the answer

Explanation:

Remember the lesson on what the guy talked about it was:

be preparedbeing focusedhelp othersask questions

Or: ( B, C, E, F. )

coming prepared

being focused

assisting others

asking questions

Proof:

give some examples where military needs have influenced technological development

Answers

Technological superiority underpins our national military strategy, allowing us to field the most potent military forces by making best use of our resources, both economic and human. It is essential for the United States to maintain superiority in those technologies of critical importance to our security.

4.8 code practice question 1 edhesive

Answers

Answer:

for x in range(5,76,5):

   print(x, end=" ")

Explanation:

Hope this helps lovely :)

4.8 code practice question 1 adhesive for x in range(5,76,5): print(x, end="").

What is adhesive?

Adhesive is defined as anything that has the ability to functionally hold materials together through surface adhesion that resists separation. PCs and laptops have numerous adhesive applications, primarily for joining electric components. In the construction of laptops, cyanoacrylates, acrylics, epoxies, UV curables, and hybrid adhesives are all utilized.

Code is defined as the collection of rules or instructions that are written in a specific programming language. In general, programming statements written by a programmer using a text editor or visual programming tool and then saved in a file are referred to as source code.

Thus, 4.8 code practice question 1 adhesive for x in range(5,76,5): print(x, end="").

To learn more about adhesive, refer to the link below:

https://brainly.com/question/29061431

#SPJ3

What will be the output of the following query on the table below?


SELECT * FROM “Table1” WHERE (“Name” = ‘Mary’ AND “Name” =‘Joe’)


Table 1

Name Age Gender

Mary 22 female

Joe 24 male

Kate 21 female

A.
Table 1
Name Age Gender
Mary 22 female
Joe 24 male
B.
Name
Mary
Joe
C.
Name Age Gender
D.
Name Age Gender
Mary 22 female
Joe 24 male
Kate 21 female

Answers

The output of the query SELECT * FROM “Table1” WHERE (“Name” = ‘Mary’ AND “Name” =‘Joe’) will be C. Name Age Gender

What are the elements of a SQL query?

The main 3 elements are:

SELECT: Indicates which columns to return.FROM: Indicates the database to use.WHERE: Indicates the condition.

We have the following query.

SELECT * // * Returns all the columns. FROM “Table1” // Uses the Table1.WHERE (“Name” = ‘Mary’ AND “Name” =‘Joe’) // The AND operator displays a record if all the conditions separated by AND are TRUE.

There is no observation for which the "Name" is both "Mary" and "Joe", so the query will be:

C.

Name Age Gender

The output of the query SELECT * FROM “Table1” WHERE (“Name” = ‘Mary’ AND “Name” =‘Joe’) will be C. Name Age Gender

Learn more about SQL here: https://brainly.com/question/25694408

This Question is confusing as is. But the answer is C or B. because in the parenthesis it says by the quote " Name” = ‘Mary’ AND “Name” =‘Joe’.

It says NAME=Mary and NAME= joe

and B says, Name Mary and Joe.

So Go with your gut feeling. It's either C or B.

I'm aware that databases are crucial for organizing and managing vast amounts of data, but I want to know more about the advanced features and capabilities available. Specifically, I'm interested in learning about data mining and how it can be used to identify patterns and relationships within large datasets to predict future trends, identify potential risks, and improve overall business performance. Additionally, I believe mastering advanced database applications is an essential skill for anyone working in data-driven industries. It enables businesses to gain a competitive edge and achieve greater success by leveraging the power of these tools.

Learn More About Query Output Tables Here: https://brainly.com/question/18896872

which sentence is true about artificial neural networks

Answers

The sentence that is true about artificial neural networks is a special type of machine learning algorithm.

What are artificial neural networks?

Artificial neural networks are the most popular machine learning algorithms modeled after the human brain.

The sentence that is true about artificial neural networks is artificial neural networks are algorithm-based machine learning.

Therefore, B is the correct option.

Learn more about artificial neural networks here:

https://brainly.com/question/23824028

#SPJ1

write a for loop to print the numbers 88, 84, 80... 44 on one line

Answers

I've included my code in the picture below. Best of luck.

please help will give brainliest

Answers

Answer:

waterfall- google search

Explanation:

terms identify the type of web resource such as .com, .edu, and .org, are called? Please answer this quickly. I need help!!!!

Answers

Answer:

domain names

Explanation:

Answer: Top-level domains.

Explanation: Quizzed

Why is my name red in Among US Please I need help.

Answers

Answer:

You're the Impostor :o

Explanation:

Which are PowerPoint 2016 quality levels?

Answers

Answer:

Do you please

mean resolution or?

Juan has performed a search on his inbox and would like to ensure that the results only include those items with
attachments. Which command group will he use?

-Scope
-Results
-Refine
-Options

Answers

Answer: Refine

Explanation:

From the question, we are informed that Juan has performed a search on his inbox and would like to ensure that the results only include those items with attachments. The command group that he'll use will be the resume command group.

The refine command group help are one whereby the results include the items that have attachments. Therefore, the answer will be option C "Refine".

Answer:

Refine

Explanation:

How often should you change your passwords?

How often do you change your passwords?

Explain why it is so important to protect your email.

Describe (in your own words) how spoofing works.

Answers

Answer:

Explanation:

I think changing a password should be changed atleast three months or four months. It's important protect your email because your email has private info such as credit cards info and social number. Spoofing works by when a unknown person sends a email so they can easily access a person private info when they open the link to the email.

(im sorry if my grammar is bad or theres incorrect spelling)

Why are response tests more difficult for some students? What can you do to make them easier for yourself?

Answers

Answer:

Because some students think that teachers give you hard things so you could pass to go to a grade, if you study you might pass

I believe that response tests are difficult for some students due to the fact that they have to think a lot about what they feel is the answer and not everyone can think fast as some student do think very slow and thus pressure is mount on them.

What are response tests?

The term response tests are known to be those test that are made up of questions that has one best or right answer.

Response tests are said to be difficult for some student due to the fact that some students do believed that teachers  do give one hard things so that the student could pass to go to a grade.

Learn more about response tests from

https://brainly.com/question/24863377

Which of the following are runtime exceptions? Select all that apply.

Select one or more:
a. NullPointerException
b. IllegalArgumentException
c. ArithmeticException
d. IndexOutOfBoundsException

Answers

Answer:

a. NullPointerException

Explanation:

In Computer programming, some examples of runtime exceptions are:

A. NullPointerException

B. IllegalArgumentException

What are runtime exceptions?

Runtime exceptions can be defined as the parent class (superclass) in all exceptions of the Java programming language that has the ability to crash a software program when they occur.

In Java programming language, some examples of runtime exceptions include the following:

IllegalArgumentExceptionDateTimeParseException MissingResourceExceptionNullPointerException

Read more on runtime exceptions here: https://brainly.com/question/3620278

#SPJ9

Match the parts of a CPU to their functions. Thanks in advance.

Answers

Answer:

ALU performs arithmetic and logical operations on input data, a register is a temporary data storage unit, and a control unit manages data transfer operations.

Explanation:

I read about it one time.

The match of the parts of a CPU to their functions:

ALU - performs arithmetic and logical operations on input data.

Register - a temporary data storage unit.

Control unit - a control unit manages data transfer operations.

What is a CPU?

A CPU is a part of a computer system. It is the main part of the computer. It is considered the brain of the computer Because it controls all the functions of the computer.

A CPU is a small chip that is present in a box, that is joined with the computer, and it runs the various function of the computer.

Thus, the correct match is:

The ALU processes input data by performing arithmetic and logical operations.

The register is a short-term data storing device.

Data transfer processes are managed by a control unit.

To learn more about CPU, refer to the link:

https://brainly.com/question/28228486

#SPJ2

11. What is the server name?
*
A. WWW
B. .net
C. http

Answers

The server name is http

write down 7 difference between data and information in a tabular form.

Answers

Answer:

sorry please I don't know the answer please forgive me

yooooooooooooooo

people are yall doing good

can yall help me

You would like to search for information about storms but not tornadoes. What type of search strategy may be useful?

entering keywords into many different search engines
a Boolean search
a wild-card search
searching for synonyms

Answers

Answer:

A-A Boolean search

Explanation:

Yes I can help you but that’s a lot of work

rolulzoss
A. State three positive uses of computers in the government sector​

Answers

Answer:

1) it's easier to keep documents

As per of her job, Anna takes pictures of shoes that are used in advertisements, brochures, and menus. She is a

Answers

Answer:

Fashion Photographer

Answer:

commercial

Explanation:

on plato/edmentum

What is the output of this program? Assume the user enters 2, 5, 1, and 6.

numA = 0
for count in range(4):
answer = input ("Enter a number: ")
fltAnswer = float(answer)
numA = numA + fltAnswer
print (numA)

Answers

Answer:

14.0

Explanation:

The loop converts each answer to a float. The accumulator variable adds the values entered.  

2.0 + 5.0 + 1.0 + 6.0 = 14.0

Answer:

14.0

Explanation:

Edge 2021

Which visual or multimedia aid would be most appropriate for introducing a second-grade class to the location of the chest’s internal organs?

a drawing
a photo
a surgical video
an audio guide

Answers

Answer:

It's A: a drawing

Explanation:

Did it on EDGE

Answer:

It is A. a drawing

Explanation:

PLEASE HELP! WILL MARK BRAINLIEST!!
what are somethings you like about Apple products from your perspective, and why do you like them?

Answers

Answer:

An apple a day keeps the doctor away...

Explanation:

i like Apple because it is a more advanced technology than android and you can have more privileges on IOS/Apple like more apps and other valuable things and new things to enjoy on that type of technology and a other thing I like about apple is the Evolving I like when they make more advanced technology from the old ones.

4.2 code practice: Question 2
Why is it saying this?

Answers

Answer: Switch line 7 and 8 then change “pet(s)” to “ pet(s)”

Explanation:

The code given says is "switch lines 7 and 8 then change “pet(s)” to “ pet(s)”.

What is coding?

We connect with computers through coding, often known as computer programming. Coding is similar to writing a set of instructions because it instructs a machine on what to do.

You can instruct computers what to do or how to behave much more quickly by learning to write code. Languages written in an imperative, functional, logical, or object-oriented style are common.

These coding language paradigms are available for programmers to select from in order to best meet their demands for a given project. It is also the name given to the source code after a compiler has prepared it for computer execution (i.e., the object code).

Therefore, the code given says is "switch lines 7 and 8 then change “pet(s)” to “ pet(s)”.

To learn more about coding, visit here:

https://brainly.com/question/17204194

#SPJ5

When is it appropriate to use an absolute reference?
when the information in a formula always relates to the same cell
when the information in a formula changes to relate to the cells next to the specified location
when the value of a specified cell must remain a positive number
when the value of a specified cell must be the same as the value of the cell immediately preceding it

Answers

Answer: The answer to this question is C when the value of a specified cell must remain a positive number

What software maintain and increase the efficiency of a computer system?

Answers

Answer:

Computer maintenance software

Explanation:

Computer maintenance software perform optimization tasks such as the removal of files that are not used in the operation of the system or by the applications in the system such as memory dumps, temporary files, and old log files

Computer maintenance software can also perform cleaning of the registry of the computer such that clutter in the computer registry is removed

Write a GUI-based program that allows the user to open, edit, and save text files. The GUI should include a labeled entry field for the filename and multi-line text widget for the text of the file. The user should be able to scroll through the text by manipulating a vertical scrollbar. Include command buttons labeled Open, Save, and New that allow the user to open, save and create new files. The New command should then clear the text widget and the entry widget.

Answers

to create a simple notepad in Python using Tkinter. This notepad GUI will consist of various menu like file and edit, using which all functionalities like saving the file, opening a file, editing, cut and paste can be done.

Now for creating this notepad, Python 3 and Tkinter should already be installed in your system. You can download suitable python package as per system requirement. After you have successfully installed python you need to install Tkinter (a Python’s GUI package).

Use this command to install Tkinter :

pip install python-tk

Importing Tkinter :

filter_none

edit

play_arrow

brightness_4

import tkinter  

import os  

from tkinter import *

 

# To get the space above for message  

from tkinter.messagebox import *

 

# To get the dialog box to open when required  

from tkinter.filedialog import *

Note : messagebox is used to write the message in the white box called notepad and filedialog is used for the dialog box to appear when you are opening file from anywhere in your system or saving your file in a particular position or place.

 

Adding Menu :

filter_none

edit

play_arrow

brightness_4

# Add controls(widget)  

 

self.__thisTextArea.grid(sticky = N + E + S + W)  

 

# To open new file  

self.__thisFileMenu.add_command(label = "New",  

                               command = self.__newFile)  

 

# To open a already existing file  

self.__thisFileMenu.add_command(label = "Open",  

                               command = self.__openFile)  

 

# To save current file  

self.__thisFileMenu.add_command(label = "Save",  

                               command = self.__saveFile)  

 

# To create a line in the dialog  

self.__thisFileMenu.add_separator()  

 

# To terminate  

self.__thisFileMenu.add_command(label = "Exit",  

                               command = self.__quitApplication)  

self.__thisMenuBar.add_cascade(label = "File",  

                              menu = self.__thisFileMenu)  

 

# To give a feature of cut  

self.__thisEditMenu.add_command(label = "Cut",  

                               command = self.__cut)  

 

# To give a feature of copy  

self.__thisEditMenu.add_command(label = "Copy",  

                               command = self.__copy)  

 

# To give a feature of paste  

self.__thisEditMenu.add_command(label = "Paste",  

                               command = self.__paste)  

 

# To give a feature of editing  

self.__thisMenuBar.add_cascade(label = "Edit",  

                              menu = self.__thisEditMenu)  

 

# To create a feature of description of the notepad  

self.__thisHelpMenu.add_command(label = "About Notepad",  

                               command = self.__showAbout)  

self.__thisMenuBar.add_cascade(label = "Help",  

                              menu = self.__thisHelpMenu)  

 

self.__root.config(menu = self.__thisMenuBar)  

 

self.__thisScrollBar.pack(side = RIGHT, fill = Y)  

 

# Scrollbar will adjust automatically  

# according to the content  

self.__thisScrollBar.config(command = self.__thisTextArea.yview)  

self.__thisTextArea.config(yscrollcommand = self.__thisScrollBar.set)  

With this code we will add the menu in the windows of our notepad and will add the things like copy, paste, save etc, to it.

Explanation:

how many lines of text are in your questionnaire document

Answers

Answer:

*9* lines - I think.

Explanation:

Jonathan is in the process of creating a photo of a fluttering flag with cars moving around in the background. He wants the flag to be stationary with trails of movement in front of it and behind it. He wants the background to be in motion. Which effects should Jonathan use for the desired result?

Answers

Answer:

Explanation:

In order to achieve the desired result, Jonathan should first apply a motion blur effect to the picture. This will cause the moving background objects to become blurred, out of focus, and appear as streaks of light since they are moving at a very fast speed. Next, Jonathan should apply an enhanced focus filter to the flag so that it stands out from the blurred background. These two effects/filters should let Jonathan achieve his desired result.

Answer:

close up and stationary are wrong for the first option and zoom is right for the second one

Explanation:

Other Questions
Four dice are placed into your hand and you roll all dice onto the floor. What are the odds that allfour dice will show an even number? A collection of triangular and square tiles contain 50 pieces and 170 sides. Write and solve a system to find how many triangular and square tiles there are. How did John Smith help save the Jamestown colony?He considered does anyone know what to do? it closes at 11:59 its ok if you dont know ^^ pls help i don't know what it is asking where do the dashes go in the sentenceNelly Sachs the story of her life reads like a modern day fairy tale was awarded the Nobel Prize for Literature. Can someone divide these two? I forgot how to over quarantine and its my sisters homework You and your friend skate at the same rate. You complete 6 laps in 5 minutes. How long does your friend take to complete 18 laps? Solve using elimination3x+3y=27x-3y= -11 Solve using long division(x^2 3x - 40) / (x+5) a tank containing 50 liter of water develops a leak and loss water at a constant rate. after 20 minutes it contains 40 liter. after a further 30 minutes the tank is 5% of its full capacity. determine the tanks capacity choose the correct transulation for the following time 3:10 in spanish help me out hear ples If you have a mole of boron and a mole of carbon would they have the same number ofatoms in each mole? Please help what does wavelength refer to? In June 21 are there more hours of daylight in San Francisco or the equator explain 2x 7 = 5x + 8solve for x Tensions between France and Europe lead to which colonial American conflict Israelite women were highly respected and had many rights within their society.TrueFalse What can you see in both the Map View and the Cross-Section View?