Challenge

The list given contains multiple numbers with different values. There are also 2 variables that define the minimum and maximum valid values. Given these variables, output the values that do not fit into the valid range as well as their index values.

data = [104, 101, 4, 105, 308, 103, 5, 107,
        100, 306, 106, 102, 108]    # list of the different numerical values
min_valid = 100  # minimum value
max_valid = 200  # maximum value

# my work is below
j = 1
print("Following is the list of elements not in the range, and their position in the array:")
for i in data:
    if int(i) > max_valid or int(i) < min_valid:
        print( str(i) + " is at position " + str(j))
    j = j + 1    
Following is the list of elements not in the range, and their position in the array:
4 is at position 3
308 is at position 5
5 is at position 7
306 is at position 10
9 306
6 5
4 308
2 4
  Input In [2]
    9 306
      ^
SyntaxError: invalid syntax

Homework/Hacks

The list given contains 4 album names - Welcome to my Nightmare, Bad Company, Nightflight, More Mayhem - and each album contains at least 4 songs within another list. Given this, write a block of code that enables users to input in integer values that correspond to the albums and songs - Welcome to my Nightmare is 1, Bad Company is 2, etc. - Then, a sentence is outputted that says Playing ___ based on which song was chosen using the numbers inputted by the user that corresponds to each song.

albums = [
    ("Welcome to my Nightmare", "Alice Cooper", 1975,   # First album list
     [
         (1, "Welcome to my Nightmare"),
         (2, "Devil's Food"),
         (3, "The Black Widow"),
         (4, "Some Folks"),
         (5, "Only Women Bleed"),
     ]
     ),
    ("Bad Company", "Bad Company", 1974,   # Second album list
     [
         (1, "Can't Get Enough"),
         (2, "Rock Steady"),
         (3, "Ready for Love"),
         (4, "Don't Let Me Down"),
         (5, "Bad Company"),
         (6, "The Way I Choose"),
         (7, "Movin' On"),
         (8, "Seagull"),
     ]
     ),
    ("Nightflight", "Budgie", 1981,
     [
         (1, "I Turned to Stone"),
         (2, "Keeping a Rendezvous"),
         (3, "Reaper of the Glory"),
         (4, "She Used Me Up"),
     ]
     ),
    ("More Mayhem", "Imelda May", 2011,
     [
         (1, "Pulling the Rug"),
         (2, "Psycho"),
         (3, "Mayhem"),
         (4, "Kentish Town Waltz"),
     ]
     ),
]

# below is my work

a = int(input('Enter a number 1-4 to choose an album album: ' ))
s = int(input('Enter a number 1-4 to choose a song in the album: '))
print (albums[a - 1][3][s - 1])
#for itm in albums:
 #   print(itm)
(2, 'Rock Steady')
1
1
Playing "Welcome to my Nightmare"

2
2
Playing "Rock Steady"