Computer Science, asked by ThisUsernamesTooLong, 3 months ago

Find the errors in the following cŏde:

name "Sharma'
Print ("Good Morning")
Print("Hello", name)
Print("How do you do?)​​

Answers

Answered by Equestriadash
97

Given statements:

  • name "Sharma'
  • Print ("Good morning")
  • Print("Hello", name)
  • Print("How do you do?)

Corrected statements:

  • name = "Sharma"
  • print("Good morning")
  • print("Hello", name)
  • print("How do you do?")

Explanation:

1. name "Sharma"

  • An assignment is being performed here. For that, an equal to (=) symbol must be there between the variable name and the value.
  • When typing strings, they must be enclosed on both ends with the same type of quotes.

2. Print ("Good morning")

  • Syntax error, 'p' in print must be in lower case.

3. Print("Hello", name)

  • Syntax error, 'p' in print must be in lower case.

4. Print("How do you do?)

  • Syntax error, 'p' in print must be in lower case.
  • Strings must be enclosed in quotes.

Equestriadash: Thanks for the Brainliest! ^_^"
rsagnik437: Outstanding! :D
Equestriadash: Thank you! ^^"
mddilshad11ab: awesome¶
Equestriadash: Thank you! :)
Answered by ItzIshan
51

Question :-

Find the errors in the following statement :

name "sharma'

print("Good morning')

print("Hello", name)

print("How do you do?)

Answer :-

The errors in this statement are following ,

1) name "Sharma' :-

In this statement we are assigning the string "Sharma" into the variable name , so the assignment operator "=" is must for assigning the value.

and the second error is , when we assign a string there must double quotes around the string.

So, the correct statement is -

name = "Sharma"

_______________________________

2) Print("Good morning")

The error in this statement is , the whole statement must be in lower case but Print is written in Upper case. This is called syntax error.

So, the correct statement is -

print("Good morning")

_______________________________

3) Print("Hello", name)

In this statement is also the same error that is syntax error of upper case.

So, the correct statement is -

print("Good morning")

_______________________________

4) Printf("How do you do?)

First error is the same syntax error, P must be in lower case.

The second error is the string that is written in the print function, must be enclosed by double quotes.

So , the correct statement is -

print("How do you do ?")

_______________________________

So, the correct statement is

name = "Sharma"

print ("Good morning")

print("hello", name)

print("How do you do ?")

_______________________________

Hope it will help you :)

Similar questions