Anyone correct my code | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Anyone correct my code

import random def random_number(x, y): t=random.randint(x, y) return t x=int(input("First Number Is: ")) y=int(input("Second Number Is: ")) i=random_number(x, y) print("Your random number is " + str(i)) file=open("/storage/emulated/0/Download/text.txt", "r") print("Your text is " + "\n" + file.read(i))

22nd Feb 2020, 10:55 AM
Edgar Minasyan
Edgar Minasyan - avatar
6 ответов
+ 3
@Edgar Minasyan This line will not work in sololearn. file=open("/storage/emulated...) The reason behind because your code is compiled on sololearn server and sololearn server cannot access your computer files or storage.
22nd Feb 2020, 11:01 AM
Maninder $ingh
Maninder $ingh - avatar
+ 2
If you are going to run the code in sololearn, you must take all of your inputs once at one line and separate them in the code.
22nd Feb 2020, 11:20 AM
Qasem
+ 2
Edgar Minasyan give your next input in next line.e.g 2 3 And this line also will not work. file=open(...) I have already mentioned it.
22nd Feb 2020, 11:23 AM
Maninder $ingh
Maninder $ingh - avatar
+ 1
Maninder $ingh is correct
22nd Feb 2020, 11:23 AM
Oma Falk
Oma Falk - avatar
0
No, the problem is in the lines of 5 and 6
22nd Feb 2020, 11:11 AM
Edgar Minasyan
Edgar Minasyan - avatar
0
Thank you so much, it works
22nd Feb 2020, 11:41 AM
Edgar Minasyan
Edgar Minasyan - avatar