Python question.

Asked 2 weeks ago, Updated 2 weeks ago, 1 views

import sys

N=int(input())

p=[]

p=list(map(int,sys.stdin.readline().split()))

I want to change it to input in this phrase, but why can't I change input in N to sys.stdin.readline() by changing the int value?

import sys

input=sys.stdin.readline()
N=int(input())

p=[]

p=list(map(int,input().split()))

python

2022-09-20 10:42

1 Answers

I read the question, but I can only think of one word.

Is this what you want?

import sys

inputtttttttt = sys.stdin.readline()

p = list(map(int, inputtttttttt.split()))

Or is it this?

NNNNNNNNNNNNNNNNNNNNN = input()

p = list(map(int, NNNNNNNNNNNNNNNNNNNNN.split()))

For your information, I don't know this, but input and input() are different, and int(input() cannot be split(). If you're wondering why, why don't you click the link below to do something called "study"?


2022-09-20 10:42

If you have any answers or tips


© 2022 pinfo. All rights reserved.