Computer Science, asked by nisanth5439, 11 months ago

Find errors from the following codes:
c=dict( )
n=input(Enter total number) i=l
while i<=n
a=raw_input("enter place")
b=raw_input(" enter number")
c(a)=b
i=i+l
print "place","\t"/’number"
for i in c:
print i,"\t",cla[i]

Answers

Answered by BruceDenmalion
0

Answer:

you should ask your question in The Free CodeCamp forum. In brainly, not many people are programmers. You can also ask in git hub.

Answered by Agastya0606
4

Given: The incorrect code.

To find: Errors in the code.

Solution:

  • Error statement         n=input(Enter total number)
  • Corrected statement n=input( "Enter total number" )  

                 Error 1 - always write the sentences in double or single quotation in print function.

  • Error statement   while i<=n
  • Corrected statement   while i<=n :

                 Error 2 - Always give a colen after the condition.

  • Error statement   c(a)=b
  • Corrected statement   c[a]=b

                Error 3 - Since c is a dictionary defined, so key should be also defined as a dictionary using squared brackets.

  • Error statement   print "place","\t"/’number"
  • Corrected statement   print "place","\t"/"number"

                Error 4 - Writing a statement in print function either with double or single quotation, but not both.

  • Error statement   print i,"\t",cla[i]
  • Corrected statement   print i,"\t",c[i]

                Error 5 - We cannot use fullstop instead of comma ans dictionary defined by a name cannot be changed.

Answer:

            So the total errors found are 5 in in the code given.

Similar questions