Math, asked by cherryreddy9914, 10 months ago

class India():
def capital(self):
print("New Delhi is the capital of India.")
def language(self):
print("Hindi is the most widely spoken language of India.")
def type(self):
print("India is a developing country.")
def capital(self):
print("Washington, D.C. is the capital of USA.")
def language(self):
print("English is the primary language of USA.")
det type(self):
print("USA is a developed country.")
obj ind = India()
obi_usa = USA()
for country in (obj ind, obj_usa):
country.capital()
country.language()​

Answers

Answered by anonymousguy1431
0

Answer:

Hi, there are a few things wrong with your code:

first of all Class is written as class in python, it is lowercase.

secondly indentation is quite important. I saw that you had not given any indententation in class or def.

You had not given a proper question but I assume that you wanted to create a for loop to execute each function in the class which sadly is not possible since classes are non-iterable.

Also try creating a different class for USA and avoid using type as it is already a function in python.

Step-by-step explanation:

Here is the code:

class India():

   def capital():

       print("New Delhi is the capital of India.")

   def language():

       print("Hindi is the most widely spoken language of India.")

   def type():

       print("India is a developing country.")

class usa():

   def capital():

       print("Washington, D.C. is the capital of USA.")

   def language():

       print("English is the primary language of USA.")

   def type():

       print("USA is a developed country.")

India.capital()

India.language()

usa.capital

usa.language()

I recommend using stack overflow for coding questions as brainly is mainly for maths, science and other more conventional subjects.

:)

Similar questions