0
def obtainResumeDescriptions(self):
    resumeCount = int(input("How many different versions of your resume do you use? "))
    print()

    resumeTrackingLog = open("resumeTrackingLog.txt", "w")

    print("Please enter a brief description of each resume.")
    print()

    for count in range(resumeCount):
        resumeNumber = str(print("Resume #", count + 1, ": ", sep=""))
        resumeDescription = str(input())
        print()
        resumeTrackingLog.write(resumeNumber + '\n')
        resumeTrackingLog.write(resumeDescription + '\n')

After executing and providing inputs, this is writing the following to the text file:

None
Project Manager
None
Product Manager
None
Senior Manager

What I'm looking for is:

Resume #1:
Project Manager
Resume #2:
Product Manager
Resume #3:
Senior Manager
martineau
  • 119,623
  • 25
  • 170
  • 301
Sara
  • 7
  • 1
  • 5
    `print` returns `None`, so the line composing `resumeNumber` doesn't do what you want. Instead look into using a formatted string https://docs.python.org/3/tutorial/inputoutput.html – Passerby Dec 09 '21 at 04:21
  • 1
    `str(print)` does not actually do what is expected; in fact it be null always, since `print` explicitly returns nothing (i..e. to say it returns `None`). also, the `str(input)` is redundant, since input function returns a string always. – rv.kvetch Dec 09 '21 at 04:26
  • Related: [How is returning the output of a function different from printing it?](/q/750136/4518341) – wjandrea Dec 09 '21 at 06:04

1 Answers1

3

The print function sends output to the console, but it does not return anything. In Python a function that doesn't explicitly return anything implicitly returns None.

You could easily replace it with an f-string:

resumeNumber = f'Resume #{count + 1}: '
Mark Ransom
  • 299,747
  • 42
  • 398
  • 622