linkedin-skill-assessments-quizzes
linkedin-skill-assessments-quizzes copied to clipboard
Python code not creating text file
#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()
Hello @DefaultBHA , thank you for submitting an issue! 👍 We highly appreciate it if you work on it as well.
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 ... .
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??
#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.
thank you guys closing