목록보안 (222)
스택큐힙리스트
playSound 함수는 정수 리스트를 가져와 각 다른 숫자에 대해 소리를 재생합니다. 따라서 리스트에 있는 숫자 중 하나가 1이라면, 1은 재생할 독특한 소리가 있습니다. def userNum(iterations): myList = [] for i in range(iterations): a = int(input(소리를위한 숫자를 입력하십시오 : )) myList.append(a) return myList print(myList) def playSound(myList): for i in range(myList): if i == 1: winsound.PlaySound(SystemExit, winsound.SND_ALIAS) 다음과 같은 오류가 발생했습니다: TypeError: 'list' 개체는 정수로 해..
다음의 프로그램을 고려해보십시오: extern int x; auto x = 42; int main() { } Clang 3.5는 이를 수용합니다 (실시간 데모), GCC 4.9와 VS2013는 그렇지 않습니다 (전자에 대한 실시간 데모). 누가 맞고 C++ 표준에서 올바른 동작이 어디에 명시되어 있는지 알려주십시오.답변 1모든 유형의 조정 후는 이와 관련된 모든 질문을 처리해야 한다. 그러므로, 나의 해석은 auto의 참여가 본질적으로 이것의 유효한 재선언 (및 정의)임을 말해주며, Clang이 옳다고 생각한다. auto가 유형의 조정으로 간주되지 않더라도 진단이 필요하지 않기 때문에, 최악의 경우 모든 명시된 구현은 각자의 방식으로 호환성이 있습니다. 저는 GCC와 Visual Studio가 다음을 영..
다음은 제가 가진 코드입니다. import nltk, os, json, csv, string, cPickle from scipy.stats import scoreatpercentile lmtzr = nltk.stem.wordnet.WordNetLemmatizer() def sanitize(wordList): answer = [word.translate(None, string.punctuation) for word in wordList] answer = [lmtzr.lemmatize(word.lower()) for word in answer] return answer words = [] for filename in json_list: words.extend([sanitize(nltk.word_tokeniz..
내가 왜 변수 c를 사용할 수 없는지 이해되지 않습니다. 코드: import turtle as t t.speed(0) t.hideturtle() c = 450 def grid(x,y,a): t.seth(0) t.penup() t.goto(x,y) t.pendown() for i in range(4): t.forward(a) t.right(90) for i in range(int(c/10)): t.seth(0) t.forward(10) t.right(90) t.forward(c) t.backward(c) for i in range(int(c/10)): t.seth(0) t.right(90) t.forward(10) t.right(90) t.forward(c) t.backward(c) t.penup() t...