Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python code help
#1
Hello! Ineed some help with code. So I needed to print out one film list and my python shell looks like this.
1 ['Fringe', 'Series, Sci-Fi, Drama', 10, '100 episodes']
2 ['Game of Thrones', 'Series, Discount LotR', 3, '73 episodes']
3 ['Stargate SG-1', 'Series, Adventure, Sci-Fi', 10, '214 episodes']
4 ['Chernobyl', 'Series, Historical Drama, Tragedy', 10, '5 episodes']
5 ['Vaprad ja Ilusad', 'Ma ei tea', 1, '8000 episodes']
6 ['Stargate Atlantis', 'Series, Adventure, Sci-Fi', 8, '100 episodes']
7 ['Star Trek: The Next Generation', 'Series, Adventure, Sci-Fi', 9, '178 episodes']
8 ['Stargate Universe', 'Series, Adventure, Sci-Fi', 9, '40 episodes']
9 ['Die Hard with a Vengeance', 'Action, Thriller, Comedy', 10, '2h 11min']
10 ['Terminal', 'Drama, Comedy', 10, '2h 8min']
11 ['Predestination', 'Sci-Fi, Mystery, Thriller', 9, '1h 37min']
12 ['Glass', 'Superhero, Thriller, Drama', 9, '2h 9min']
13 ['I, Robot', 'Sci-Fi, Action, Adventure', 9, '1h 55min']
14 ['Alien', 'Horror, Sci-Fi', 2, '1h 57min']
15 ["Harry Potter and the Philosopher's Stone", 'Fantasy, adventure', 10, '2h 39min']
16 ['Forrest Gump', 'Drama, Adventure, Romance', 10, '2h 26min']
17 ['The Lord of the Rings: The Two Towers', 'Fantasy, Adventure', 10, '3h 55min']


I need to choose one film number and my code must say: Choose the film number:
Playing: (Here needs to be this film name, that number I just wrote to shell)
and then: "The film is over"
Reply
#2
show us what you have tried so far.
Reply
#3
Basically nothing. I dont know, how to do it. I only want to know, how this code looks like or what structure I need to use, if I want to choose number between 1-17 and a movie with that number must pop up, for example I choose 4 and a movie: Chernobyl’, ‘Series, Historical Drama, Tragedy’, 10, ‘5 episodes pops up
Reply
#4
Assuming you have made a list of the films cable ‘films’
Print(fils[3])

Lower case p in print and films not fils, sorry, working from iPad
Reply
#5
How can I sort movie ratings. From smallest to largest. Rating number is before the length of the film or the epidose number. How this code looks like


1 ['Fringe', 'Series, Sci-Fi, Drama', 10, '100 episodes']
2 ['Game of Thrones', 'Series, Discount LotR', 3, '73 episodes']
3 ['Stargate SG-1', 'Series, Adventure, Sci-Fi', 10, '214 episodes']
4 ['Chernobyl', 'Series, Historical Drama, Tragedy', 10, '5 episodes']
5 ['Vaprad ja Ilusad', 'Ma ei tea', 1, '8000 episodes']
6 ['Stargate Atlantis', 'Series, Adventure, Sci-Fi', 8, '100 episodes']
7 ['Star Trek: The Next Generation', 'Series, Adventure, Sci-Fi', 9, '178 episodes']
8 ['Stargate Universe', 'Series, Adventure, Sci-Fi', 9, '40 episodes']
9 ['Die Hard with a Vengeance', 'Action, Thriller, Comedy', 10, '2h 11min']
10 ['Terminal', 'Drama, Comedy', 10, '2h 8min']
11 ['Predestination', 'Sci-Fi, Mystery, Thriller', 9, '1h 37min']
12 ['Glass', 'Superhero, Thriller, Drama', 9, '2h 9min']
13 ['I, Robot', 'Sci-Fi, Action, Adventure', 9, '1h 55min']
14 ['Alien', 'Horror, Sci-Fi', 2, '1h 57min']
15 ["Harry Potter and the Philosopher's Stone", 'Fantasy, adventure', 10, '2h 39min']
16 ['Forrest Gump', 'Drama, Adventure, Romance', 10, '2h 26min']
17 ['The Lord of the Rings: The Two Towers', 'Fantasy, Adventure', 10, '3h 55min']
Reply
#6
You already asked that: python code help.
Please do not duplicate your questions.
Reply
#7
Put your entries in an array.
Each element of the array will also be a list with 4 items.
Do a bubble sort on the 3rd item in those arrays.

If that is not clear, go back and look over your prior lessons.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020