ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1001. Reverse Root

Python Wrong answer test#1
Posted by Evgen1yK 13 Jun 2022 03:05
I'm just learning python. Can you please tell me where could be the error?

import math

data = input()
length = len(data)
list = []
i = 0

while i < length:
    if data[i] != " " and data[i] != "\n":
        end_index = i
        for j in range(i + 1, length):
            if data[j] == " " or data[i] == "\n":
                break
            end_index += 1
        list.insert(0, int(data[i:end_index + 1]))
        i = end_index + 1
    else:
        i += 1

for e in list:
    value = round(math.sqrt(e), 4)
    print(f'{value:.4f}')
Re: Python Wrong answer test#1
Posted by yyll 17 Jun 2022 14:38
You only need to write about 3 lines of python code to solve this.

try:
  help(str.split)
  help(reversed)
  help(str.join)