Computer Science, asked by Madhan9499, 11 months ago

What gets printed?
country_counter = {}
def addone(country):
if country in country_counter:
country_counter[country] + = 1
else:
country_counter[country] = 1
addone(‘China’)
addone(‘Japan’)
addone(‘china’)
print len(country_counter)

Answers

Answered by rehmatsara
0

Answer:

Her body fit right in my hands, la la la

It felt like ooh la la la, yeah

Answered by Anonymous
2

The output of the given code is :

country_counter = {}

def addone(country):

      if country in country_counter:

             country_counter[country] = country_counter[country] + 1

      else:

             country_counter[country] = 1

addone('China')

addone('Japan')

addone('china')

print (len(country_counter))

Output:

3

  • Here, the output is 3 because, 3 elements are added in the dictionary country_counter , i.e. China, Japan, and china.

Similar questions