Last active
February 14, 2019 11:13
-
-
Save qmmr/6f27c754e9f81c9018c7adba5e2609d8 to your computer and use it in GitHub Desktop.
Homework Assignment #1: Variables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
pirple.com/python | |
Homework #1: Variables | |
The purpose of this file is to get familiar with the variables and how we assign different values to them. | |
Additionally you get to know how single and multiline comments work in Python. | |
Run this file from terminal: python3 main.py | |
""" | |
# Song attributes | |
title = "We Are the Champions" | |
album = "News of the World" | |
artist = "Queen" | |
genre = "Arena rock" | |
release_year = 1977 | |
# Floats: Length in minutes and seconds | |
length = 2.59 | |
# Integer: length in seconds | |
length_seconds = 179 | |
songwriter = "Freddie Mercury" | |
producers = "Queen, Mike \"Clay\" Stone" | |
# Print all the info aboute song, traditonal | |
# print("Title: \"{0:s}\"".format(title)) | |
# print("Album: \"{0:s}\"".format(album)) | |
# print("Artist: \"{0:s}\"".format(artist)) | |
# print("Release year: {0:d}".format(release_year)) | |
# print("Genre: \"{0:s}\"".format(genre)) | |
# print("Length: {0:4.2f}".format(length)) | |
# print("Songwriter: \"{0:s}\"".format(songwriter)) | |
# print("Producers: \"{0:s}\"".format(producers)) | |
# Print all information in one go | |
print(""" | |
Title: \"{0:s}\" | |
Artist: \"{1:s}\" | |
Album: \"{2:s}\" | |
Genre: \"{4:s}\" | |
Release year: {3:d} | |
Length: {5:4.2f} | |
Songwriter: \"{6:s}\" | |
Producers: \"{7:s}\" | |
""".format(title, artist, album, release_year, genre, length, songwriter, producers)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment