Computer Science

Find the errors. State reasons.

for Name in [Amar, Shveta, Parag]
    IF Name[0] = 'S':
        print(Name)

Python List Manipulation

4 Likes

Answer

The errors in this code are:

  1. In the list [Amar, Shveta, Parag], each element should be enclosed in quotes because they are strings.
  2. The equality comparison operator is '==' instead of = for checking equality.
  3. if statement should be lowercase.

Answered By

1 Like


Related Questions