w3resource

Python: Get the copyright information

Python Basic: Exercise-75 with Solution

Write a Python program to get the copyright information and write Copyright information in Python code.

Pictorial Presentation:

Get the copyright information

Sample Solution-1:

Python Code:

# Import the sys module, which provides access to Python interpreter variables and functions.
import sys

# Display a header for Python copyright information.
print("\nPython Copyright Information")

# Display the copyright information about Python using sys.copyright.
print(sys.copyright)

# Print an empty line for better readability.
print()

Sample Output:

Python Copyright Information                                                                                  
Copyright (c) 2001-2016 Python Software Foundation.                                                           
All Rights Reserved.                                                                                          
                                                                                                              
Copyright (c) 2000 BeOpen.com.                                                                                
All Rights Reserved.                                                                                          
                                                                                                              
Copyright (c) 1995-2001 Corporation for National Research Initiatives.                                        
All Rights Reserved.                                                                                          
                                                                                                              
Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.                                            
All Rights Reserved. 

Sample Solution-2:

Python Code:

print("Python copyright information:\n")
print(copyright)

Sample Output:

Python copyright information:

Copyright (c) 2001-2018 Python Software Foundation.
All Rights Reserved.

Copyright (c) 2000 BeOpen.com.
All Rights Reserved.

Copyright (c) 1995-2001 Corporation for National Research Initiatives.
All Rights Reserved.

Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.
All Rights Reserved.

Copyright information in Python code:

Python Code:

__author__ = "Software Authors Name"
__copyright__ = "Copyright (C) 2004 Author Name"
__license__ = "Public Domain"
__version__ = "1.0"
print("copyright information in Python code:\n")

Sample Output:

copyright information in Python code:

Python Code Editor:

 

Previous: Write a Python program to hash a word.
Next: Write a Python program to get the command-line arguments (name of the script, the number of arguments, arguments) passed to a script.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://198.211.115.131/python-exercises/python-basic-exercise-75.php