linkedin-skill-assessments-quizzes icon indicating copy to clipboard operation
linkedin-skill-assessments-quizzes copied to clipboard

Python code not creating text file

Open DefaultBHA opened this issue 2 years ago • 4 comments

#Take input from user and assigns it to variables

print("What is your first name?") input1 = input() print("What is your last name") input2 = input()

#Open the text.txt file for appending.

file1 = open('iasi.txt', 'a')

#Write the content of the variables to the text.txt file file1.write(input1) file1.write(" ") file1.write(input2) file1.write("\n")

#Close the text.txt file file1.close()

DefaultBHA avatar May 18 '22 14:05 DefaultBHA

Hello @DefaultBHA , thank you for submitting an issue! 👍 We highly appreciate it if you work on it as well.

github-actions[bot] avatar May 18 '22 14:05 github-actions[bot]

Hello, @DefaultBHA! Thanks for opening the issue. to what question did you write this example? please provide more details: quiz name, number or name of the question.

e.g.

Q12 What is ....?

  • [ ] An abstract class ... .
  • [ ] An abstract class ... .
  • [ ] An abstract class ... .
  • [ ] An abstract class ... .

Ebazhanov avatar May 19 '22 06:05 Ebazhanov

your asking why python doesn't create a file when your code only has functions for variables and adding those to a file but your code doenst create it??

101br03k avatar May 19 '22 10:05 101br03k


#Take input from user and assigns it to variables

print("What is your first name?")
input1 = input()
print("What is your last name")
input2 = input()

#Open the text.txt file for appending.

file1 = open('iasi.txt', 'a')

#Write the content of the variables to the text.txt file
file1.write(input1)
file1.write(" ")
file1.write(input2)
file1.write("\n")

#Close the text.txt file
file1.close()

@DefaultBHA there is no issue in given code it is creating the text file to store input.

Sd-Shiivam avatar Oct 17 '22 16:10 Sd-Shiivam

thank you guys closing

Ebazhanov avatar Oct 17 '22 18:10 Ebazhanov