mercredi 4 mars 2020

How to use loop when data type is dictionary

suspect = {'Height':6,'Colour':'Fair','Residency':'Pune'}
Name = input('Please enter your name')
Verification = int(input('Please enter Height ')

if Verification == suspect['Height']:
    print('Suspect is detected  for 1st level')
else:
    print('Suspect is not detected  for 1st level')**

Note that my scenario is: If suspect is detected with {'Height': 3, 'Colour': 'Fair', 'resident': 'Pune'}-condition the name should be saved and code should be continued running. It mean that 'Please enter your name' and 'Please Enter Height' should be continued to ask.

Aucun commentaire:

Enregistrer un commentaire