Форум сайта python.su
0
программа не вставляет результат того, что ввел пользователь в историю
#-*- coding : cp1251 -*- import random ans = [] str = "" fileStory = "story_" fileQuestion = "question_" rd = random.randint(1,3) if rd == 1: fileStory += "a.txt" fileQuestion += "a.txt" elif rd == 2: fileStory += "b.txt" fileQuestion += "b.txt" elif rd == 3: fileStory += "c.txt" fileQuestion += "c.txt" with open(fileQuestion) as ques: for line in ques: print(line[:len(line)-1]) ans.append(raw_input()) ans.append(' ') ans.append(' ') with open(fileStory) as story: for line in story: str += line[:len(line)-1] str += ans.pop(0) print(str)
Отредактировано FishHook (Дек. 5, 2013 16:18:53)
Офлайн
568
str - это функция стандартной библиотеки, придумай другое имя переменной
Офлайн