im a novice at python, i've wrote this those far it needs but i cant get it to run past line 4 the error is a syntax error def fileload filename what am i not doing correctly?
import random
def fileload(filename)
with open(filename,"r") as names:
for item in names:
return item
collect lines from files and append to list
def main():
name=[]
desc=[]
title=[]
filename=fileload(names.txt)
for item in names:
name.append(item)
break
filename=fileload(descriptors.txt)
for item in description:
desc.append(item)
break
filename=fileload(titles.txt)
for item in titles:
title.append(item)
random namer
def namer():
i=random.randint(0,len(names))
first_name=names[i]
last_name=names[i]
return first_name last_name
random titler
def titler():
i= random.randint(0,len(title))
random_title=title[i]
random description
def descript():
i=random.randint(0,len(desc))
random_description = desc[i]
print out random names, titles and descriptor
print(f"you are; {random_title} {first_name} {last_name} the {random_title}")
namer()
titler()
descript()
main()
also some maybe out of my intended indentation blame the website for that
Aucun commentaire:
Enregistrer un commentaire