We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5c5a30c commit 961838fCopy full SHA for 961838f
1-1.py
@@ -0,0 +1,13 @@
1
+#!/usr/bin/env python
2
+
3
+readings = [int(row) for row in open('1.input').readlines()]
4
5
+increments = 0
6
+last = readings[0]
7
8
+for i in range(1, len(readings)):
9
+ if readings[i] > last:
10
+ increments += 1
11
+ last = readings[i]
12
13
+print(increments)
1-1.rb
+#!/usr/bin/env ruby
+readings = File.read('1.input').lines.map(&:to_i)
+1.upto(readings.size - 1) do |i|
+ increments += 1 if readings[i] > last
+end
+print increments, "\n"
0 commit comments