Question

What is wrong with the following code snippet? print("Hello") print("World!") The print function cannot be called...

What is wrong with the following code snippet? print("Hello") print("World!") The print function cannot be called twice The print function is missing an argument Nothing, the program prints Hello World on the same line The second line should not be indented

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

The error is due to the compiler is thinking that both are 1 statement. So, put a semi colon in between

print("Hello"); print("World!")

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
What is wrong with the following code snippet? print("Hello") print("World!") The print function cannot be called...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • What is wrong with the following function? def print_circle_area(radius): print(3.14*radius**2) a) the function body(code) is not...

    What is wrong with the following function? def print_circle_area(radius): print(3.14*radius**2) a) the function body(code) is not indented correctly b) radius should be r c) it's missing a return value d) nothing seems to be wrong with this

  • Python: 1) Consider the following code segment: try : inputFile = open("lyrics.txt", "r") line = inputFile.readline()...

    Python: 1) Consider the following code segment: try : inputFile = open("lyrics.txt", "r") line = inputFile.readline() print(line) _____________________ print("Error") What should be placed in the blank so that the program will print Error instead of crashing if an exception occurs while opening or reading from the file? Group of answer choices a- except RuntimeError : b- except EnvironmentError : c- except IOError : d- except IndexError : 2) Consider the following code segment: line = "hello world!" parts = line.split()...

  • What is wrong with the following code snippet? int main() { int width = 10; height...

    What is wrong with the following code snippet? int main() { int width = 10; height = 20.00; cout << "width = " << width << " height = " << height << endl; return 0; } The code snippet uses an uninitialized variable. The code snippet uses an undefined variable. The code snippet attempts to assign a decimal value to an integer variable. The code snippet attempts to assign an integer value to a decimal variable.

  • ,,1. Which of the following statments are valid C++ statements? A) cout << "Hello World" :...

    ,,1. Which of the following statments are valid C++ statements? A) cout << "Hello World" : B) cout << Hello World; C) cout << "Hello " << "World" ; D) cout << "Hello" << "World" ; 2. What is the difference between the literals 'A' and "A"? ,3. Read the input from user; Check for valid entries If input is invalid: print an error message; else: calculate the result and print to the console; exit; The code snippet above may...

  • Need help with this C program based on threads. If someone could help as soon as...

    Need help with this C program based on threads. If someone could help as soon as possible thanks in advance. Write a multi-threaded C program using pthread_create() according to the following instructions: Your program should create exactly 2 new threads in the main() function, each of which invokes a different function. Print the thread IDs of the two new threads after they are created. The first newly created thread invokes the following function void *print_string_in_reverse_order(void *str)  {       // this function accepts...

  • ASSEMBLY LANGUAGE Write a program using author's routine, WriteString, to print "Hello World". This routine will...

    ASSEMBLY LANGUAGE Write a program using author's routine, WriteString, to print "Hello World". This routine will output to the screen any character data pointed to by the EDX register. It will continue to print until it runs into the null character (zero). We need only to move the address into the EDX register and calll his routine. Lookup in the ASCII code chart the value reqresented by CR and LF. In the program I will define these values using the...

  • Write a function that takes two arguments, both strings. Print "YES" if the second string argument...

    Write a function that takes two arguments, both strings. Print "YES" if the second string argument contains only characters found in the first string argument. Print "NO" if the second string argument contains characters not in the first. Here are some sample calls. In your program, call the function 3 times with the same arguments shown below. makeStr("hello", "") makeStr("hello", "olleloheloeloheloel") makeStr("hello", "olleloheloteloheloel") # YES # YES # NO

  • C - language please 1. Create a program that does the following, make sure you can...

    C - language please 1. Create a program that does the following, make sure you can complete this before moving to further questions, when compiling add the -Ipthread argument, if you are using gcc use the -pthread argument. Creates two threads, the first uses a function hello world() which prints hello world, the second uses a function goodbye() which prints goodbye. • Each function has a random sleep duration before printing the output - After running your program a few...

  • use c code to Develop a function void printToggled(char str[]) that gets a string as a...

    use c code to Develop a function void printToggled(char str[]) that gets a string as a parameter and prints every lowercase character as an uppercase one and vise versa. For example, if the string submitted as a parameter is Hello WorlD! The function should print hELLO wORLd! Hint:answer must include output

  • What number will the following code snippet print? int numbers[8] = { 34, 42, 6, 11,...

    What number will the following code snippet print? int numbers[8] = { 34, 42, 6, 11, 29, 1, 89, 62}; cout << numbers[7];

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT