Computer Science, asked by shivrajmehto, 5 months ago



What is the output of the following code
if 'bar' in {'foo': 1, 'bar': 2, 'baz': 3}:
print(1)
print(2)
if 'a' in 'qux':
print(3)
print(4)

1
2
4

Error

1
2
3
4

4​

Answers

Answered by AdarshChahar
1

Answer:

What is the output of the following code

if 'bar' in {'foo': 1, 'bar': 2, 'baz': 3}:

print(1)

print(2)

if 'a' in 'qux':

print(3)

print(4)

1

2

4

Error

1

2

3

4

4

397

Answered by mindfulmaisel
0

The output of the above algorithm is :

1

2

4

Given:

if 'bar' in {'foo': 1, 'bar': 2, 'baz': 3}:

print(1)

print(2)

if 'a' in 'qux':

print(3)

print(4)

solution:

if 'bar' in {'foo': 1, 'bar': 2, 'baz': 3}:

print(1)

print(2)

if 'a' in 'qux':

print(3)

print(4)

The output of the above algorithm is :

1

2

4

Similar questions