Python is not printing my input in while loop
<p>I'm having trouble with my python code as it is not printing anything after I input something into the compiler. </p>

<p>I'm trying to write code that uses a while loop and allows the user to enter an album's artist and title. Then I should be able to call <code>make_album</code> with the user's input and print the dictionary that's created. </p>

<p>However, after I enter the artist and title, nothing prints.</p>

<p>Here is my python code:</p>

<pre><code>def make_album(artist_name, album_title, num_tracks = ''):
    """Return artist and album title name."""
    CD1 = {'sonic': artist_name, 'his world': album_title}
    CD2 = {'shadow': artist_name, 'all hail shadow': album_title}
    CD3 = {'silver': artist_name, 'dream of an absolution': album_title}
    if num_tracks:
        CD = artist_name + ' ' + album_title + ' ' + num_tracks
    else:
        CD = artist_name + ' ' + album_title
    return CD.title()

while True:
    print("\nEnter album's artist and title: ")
    print("\nEnter 'q' at anytime to quit")

    a_name = input("Artist name: ")
    if a_name == 'q':
        break

    a_title = input("Album title: ")
    if a_title == 'q':
        break

make_album(a_name, a_title)
formatted_album = make_album(a_name, a_title)
print(formatted_album)
</code></pre>

<p>Does anyone have any idea as to what I may be doing wrong? Any feedback would be greatly appreciated. </p>

<p>Thank you for your time.</p>

<p>If you call to your <code>make_album</code> method in the bottom of your code it'll only show your three cd variables (or constants?), but that will only happen if you pass to it something to print.</p>

<p>You're returning <code>CD.title()</code>, but what's title? a method from CD? where is it defined?, there's no value for title nor it's defined inside your CD1 nor to CD3, if you want to print that try, replacing it for <code>return CD1, CD2, CD3</code>, this way at least you're going to see them when you press q to exit from the prompt. And this will only happen one time, that's to say, you're going to see it only one time when press 'q', because you don't have the call to your method <code>make_album</code>, nor the <code>formatted_album</code> nor the of this same inside of your <code>while</code> block, give them the necessary tab space to be inside of it, this way they're going to be whenever you enter a new artist name and/or a new album title.</p>

<p>And what about your CDs name, are they constants or variables?, if they're dictionaries and you're adding its <code>num_tracks</code> values can be considered as constants or not?</p>

<pre><code>def make_album(artist_name, album_title, num_tracks = ''):
    """Return artist and album title name."""
    CD1 = {'sonic': artist_name, 'his world': album_title}
    CD2 = {'shadow': artist_name, 'all hail shadow': album_title}
    CD3 = {'silver': artist_name, 'dream of an absolution': album_title}

    if num_tracks:
        CD = artist_name + ' ' + album_title + ' ' + num_tracks
    else:
        CD = artist_name + ' ' + album_title

    return CD1, CD2, CD3

while True:
    print("\nEnter album's artist and title: ")
    print("\nEnter 'q' at anytime to quit")

    a_name = input("Artist name: ")
    if a_name == 'q':
        break

    a_title = input("Album title: ")
    if a_title == 'q':
        break

    make_album(a_name, a_title)
    formatted_album = make_album(a_name, a_title)
    print(formatted_album)
</code></pre>

<p>I hope to have helped you, cheers!</p>

python