# -*- coding: utf-8 -*-
"""ln 10 Book Back Exercises_Tuples & Dictionaries.ipynb
Automatically generated by Colaboratory.
Original file is located at
    https://colab.research.google.com/drive/12xYhUY64L23-NQ8q7q-Fp-PeqUEiglL5
#About this notebook
Notebook made by: Dhananjay M.R
Subject: Computer Science - Grade 11 CBSE
Language: - Python
Topic: Book Back Exercise Questions of the lesson - Lists
Execution mode: Script Mode

Note: Theory based questions are not available in this notebook.

Note: This is a compilation of the entire book. 
If you run this program directly, you may encouter with error.
Therefore it is recommended to cut the program (modify) and run it part by part

Refering the original file at Colaboratory is recommended
Original file is located at
    https://colab.research.google.com/drive/12xYhUY64L23-NQ8q7q-Fp-PeqUEiglL5
"""

"""#Qn No.1 Find the output of the following statements: 

Consider the following tuples, tuple1 and tuple2:

tuple1 = (23,1,45,67,45,9,55,45) 

tuple2 = (100,200)
"""

tuple1 = (23,1,45,67,45,9,55,45)
tuple2 = (100,200)

# Part i
print('Solution for part i of the question:')
print(tuple1.index(45))
print('')
# End of part i :)

# Part ii
print('Solution for part ii of the question:')
print(tuple1.count(45))
print('')
# End of part ii :)

# Part iii
print('Solution for part iii of the question:')
print(tuple1 + tuple2)
print('')
# End of part iii :)

# Part iv
print('Solution for part iv of the question:')
print(len(tuple2))
print('')
# End of part iv :)

# Part v
print('Solution for part v of the question:')
print(max(tuple1))
print('')
# End of part v :)

# Part vi
print('Solution for part vi of the question:')
print(min(tuple1))
print('')
# End of part vi :)

# Part vii
print('Solution for part vii of the question:')
print(sum(tuple2))
print('')
# End of part vii :)

# Part viii
print('Solution for part viii of the question:')
print(sorted(tuple1))
print(tuple1)
# End of part viii :)

"""#Qn No.2 Find the output of the following statements:
Consider the following dictionary stateCapital: 

stateCapital = {"AndhraPradesh":"Hyderabad", "Bihar":"Patna","Maharashtra":"Mumbai",  "Rajasthan":"Jaipur"}
"""

stateCapital = {"AndhraPradesh":"Hyderabad", "Bihar":"Patna",
                "Maharashtra":"Mumbai", "Rajasthan":"Jaipur"}

# Part i
print('Solution for part i of the question:')
print(stateCapital.get("Bihar"))
print('')
# End of part i :)

# Part ii
print('Solution for part ii of the question:')
print(stateCapital.keys())
print('')
# End of part ii :)

# Part iii
print('Solution for part iii of the question:')
print(stateCapital.values())
print('')
# End of part iii :)

# Part iv
print('Solution for part iv of the question:')
print(stateCapital.items())
print('')
# End of part iv :)

# Part v
print('Solution for part v of the question:')
print(len(stateCapital))
print('')
# End of part v :)

# Part vi
print('Solution for part vi of the question:')
print("Maharashtra" in stateCapital)
print('')
# End of part vi :)

# Part vii
print('Solution for part vii of the question:')
print(stateCapital.get("Assam"))
print('')
# End of part vii :)

# Part viii
print('Solution for part viii of the question:')
del stateCapital["Rajasthan"]
print(stateCapital)
# End of part viii :)
