Найти - Пользователи
Полная версия: помогите найти ошибку
Начало » Python для новичков » помогите найти ошибку
1
Evgeniya
программа не вставляет результат того, что ввел пользователь в историю
#-*- 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
str - это функция стандартной библиотеки, придумай другое имя переменной
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB