⌘K
Flycodx

Validate Farm Sensor Reading Format

Validate Farm Sensor Reading Format

MediumStrings0% accepted

A farm in Punjab has multiple sensors reporting temperature and humidity in format 'S1:28.5,S2:65.3,S3:35.2'. Each valid reading must be 'SX:VALUE' where X is digit and VALUE is numeric. Priya needs to count invalid entries in a log.

Approach

Given a comma-separated string of sensor readings in format SX:VALUE (X is sensor ID digit, VALUE is numeric), count how many readings have invalid format (missing colon, invalid sensor ID, non-numeric value).

Input

S1:28.5,S2:65.3,S3:35.2

Output

0
solution.py
Loading editor...
Test 1
Test 2
Test 3

Press Run to test your custom input, or Submit to judge against all test cases.

Sign in to continue

Create a free account to run code, submit solutions and track progress.

  • Free forever — no credit card
  • 10+ languages with live execution
  • Points, streaks & leaderboards
Auto Save OnLn 1, Col 1Spaces: 4UTF-8LFPython 3