Skip to content

Commit c978625

Browse files
Fix Collatz demo to use integer division (#1541)
- Change self.count /= 2 to self.count //= 2 in run_step method - Ensures int state variable receives int values instead of float - Maintains mathematical correctness of Collatz conjecture algorithm Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: [email protected] <[email protected]>
1 parent fce9247 commit c978625

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/events/chaining_events.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class CollatzState(rx.State):
7474

7575
if self.count % 2 == 0:
7676
# If the number is even, divide by 2.
77-
self.count /= 2
77+
self.count //= 2
7878
else:
7979
# If the number is odd, multiply by 3 and add 1.
8080
self.count = self.count * 3 + 1

0 commit comments

Comments
 (0)