Submission details
Task:Lukujono
Sender:uruuruirii
Submission time:2025-11-05 17:52:48 +0200
Language:text
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttimescore
#10.00 s0details

Code

a = int(input("Write a number: "))

# Open (or create) a text file for writing
with open("collatz.txt", "w") as file:
    while True:
        file.write(str(a) + "\n")  # write current value to the file

        if a % 2 == 0:
            a = a // 2
        else:
            a = a * 3 + 1

        if a == 1:
            file.write(str(a) + "\n")  # write the final 1
            break

print("Sequence written to collatz.txt")

Test details

Test 1 (public)

Verdict:

input
(empty)

correct output
(empty)

user output
a = int(input("Write a number:...

Feedback: Error: invalid command a