'Verify if value is in external text file. If True print value in another file

Let's say I had a file called random.txt containing:

Youtube
Google
Amazon
Facebook

In my Python file I have a variable with a value:

var = "Google"

What code would be needed to verify if var is in the random.txt. And print True in a new file called true.txt?

Thank you in advance for your responses.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source