私は何か間違っている必要がありますが、わかりません。私はある関数から別の関数に引数を渡そうとしていますが、私は "何かが定義されていない"ということを続けていますが、それを修正する方法を見つけることはできません。関数から関数pythonへの引数の受け渡しに問題があります
def Information():
#for x in range(0,3):
#if x==0:
# print("first user")
#elif x==1:
# print("Second user")
#elif x==2:
# print("Third user")
age=int(input("Please enter your age: "))
height=int(input("Please enter your height in inches: "))
eye=input("Please enter your eye color: ")
First=input("Please enter your first name: ")
Last=input("Please enter your last name: ")
Street=input("Please enter your street address: ")
City=input("Please enter your city: ")
State=input("Please enter your state: ")
Zip=int(input("Please enter your zip code: "))
Infile=open('DataFile1.txt', 'a')
Infile.write(str(age)+'\n')
Infile.write(str(height)+'\n')
Infile.write(eye+'\n')
Infile.write(First+'\n')
Infile.write(Last+'\n')
Infile.write(str(Street)+'\n')
Infile.write(City+'\n')
Infile.write(State+'\n')
Infile.write(str(Zip)+'\n')
Infile.close()
def Duplicate():
info=[]
with open("DataFile1.txt") as infile:
for line in infile:
info.append(line)
print(info)
age2 = info[0]
height2 = info[1]
eye_color2 = info[2]
first_name2 = info[3]
last_name2 = info[4]
street_address2 = info[5]
city2 = info[6]
state2 = info[7]
zip_code2 = info[8]
return(age2,height2,eye_color2,first_name2,last_name2,street_address2,state2,zip_code2)
def Print(age,height,eye_color,first_name,last_name,street_address,city,state,zip_code):
print(last_name, first_name)
print(street_address)
print(city, state, zip_code)
print('Age: ', age)
print('Height: ', height)
print('Eye Color: ', eye_color)
def Main():
Information()
Duplicate()
Print(age,height,eye_color,first_name,last_name,street_address,city,state,zip_code)
Main()
返されるDuplicate()の値は、ある変数に送信する必要があります。 –
私は変数に送信すると、入力された形式でそれを使用する2番目の関数でどのように出力することができますか?今私はそれが重複(物事)として設定し、私は受け取ったとエラーが必要な引数が欠落してください。 – shadow