Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Quiz
5. Question 4
Summary

Instruction

Very well done! Question 4 is now waiting for you.

Exercise

You are given a string to parse. It contains a list of parameters in the following format:

param1_name:param1_value;param2_name:param2_value;...

Note that parameter names are always strings and parameter values are always integers.

Your task is to parse the string into a Python dictionary and print it:

Input:

input_string = "temperature:5;altitude:145;pressure:945;speed:2345;bearing:27"

Example output (the order of printed dictionary elements may vary):

{'temperature': 5, 'altitude': 145, 'pressure': 945, 'speed': 2345, 'bearing': 27}

Stuck? Here's a hint!

You will need to use the split() function twice. Split first by semicolons and then by colons.