Need a program in python.
Asterix and Obelix want to store and process information about movies they are interested in. So, you have been commissioned to write a program in Python to automate this. Since they are not very computer literate, your program must be easy for them to use. They want to store the information in a comma separated text file. Using this they would need to generate a report – see all items AND show a bar chart based on number of movie of each genre.
Your task Write a menu based program to allow user to
0. Exit program
1. Enter details
2. Reports
Task details:
0. Exit
When user enters 0, exit the program.
1. Enter details
When 1 is selected; allow user to enter the following. Perform specified validation







import turtle
genre = ['romance', 'rom-com', 'action', 'war', 'spy',
'sci-fic', 'horror', 'history', 'fantasy', 'animated']
rating = [1,2,3,4,5,6,7,8,9,10]
# Function for Main Menu
def menu():
print('0.Exit Program')
print('1.Enter details')
print('2.Report')
choice = int(input('Enter your choice: '))
if choice == 0:
print('Bye!!')
exit(0)
elif choice == 1:
choice_1() # colling the choice 1 function
elif choice == 2:
choice_2() # colling the choice 2 function
else:
print("Wrong option selected.\nBye!!")
# function to print data in tabular form
def print_table():
fobj = open('fileName.txt','r') # file name is fileName.txt change
it according to your need
lines = fobj.readlines() # reading lines from the file object
for line in lines:
data = line.split(',')
print(data[0] + ' '*(70-len(data[0])) + data[1] + '
'*(15-len(data[1])) + data[2] )
#function to draw the graph
def draw():
def drawBar(t, height, a):
""" Get turtle t to draw one bar, of height. """
t.begin_fill() # start filling this shape
t.left(90)
t.forward(height)
t.write(a + " :- " + str(height), align="left")
t.right(90)
t.forward(40)
t.right(90)
t.forward(height)
t.left(90)
t.end_fill() # stop filling this shape
genre = {'romance':0, 'rom-com':0, 'action':0, 'war':0, 'spy':0,
'sci-fic':0, 'horror':0, 'history':0, 'fantasy':0,
'animated':0}
fobj = open('fileName.txt','r')
lines = fobj.readlines()
for line in lines:
data = line.split(',')
genre[data[1]] = genre[data[1]] + 1
maxheight = max(genre.values())
numbars = len(genre)
border = 10
wn = turtle.Screen() # Set up the window and its
attributes
wn.setworldcoordinates(0-border, 0-border, 40*numbars+border,
maxheight+border)
wn.bgcolor("white")
tess = turtle.Turtle() # create tess and set some
attributes
tess.color("blue")
tess.fillcolor("red")
tess.pensize(3)
for a in genre.keys():
drawBar(tess, genre[a], a)
wn.exitonclick()
fobj.close()
#function to display the graph
def displaydata():
print('Name' + ' '*65 + 'Genre' + ' '*10 + 'Rating')
print('='*91)
print_table()
print('='*91)
draw()
# function for choice 1
def choice_1():
option = 'y'
while option == 'y':
movieName = input('Enter the movie Name(must be atleast 5 character
long): ')
if len(movieName) < 5:
print('Movie name must be atleast 5 character long')
print('Please Try again..')
continue
print('for genre available options are:')
print(genre)
genreChoice = input('Enter your choice: ')
if genreChoice not in genre:
print("selected wrong choice.\nTry again.")
continue
ratingChoice = int(input('Enter rating from 1 to 10 (integer value
only): '))
# Write data into the file
fobj = open('fileName.txt', 'a')
fobj.write(movieName + ',' + genreChoice + ',' + str(ratingChoice)+
'\n')
fobj.close()
option = input("Do you want to enter more data( y/n ):
").lower()
# Function for choice 2
def choice_2():
print('0.return to previous menu:')
print('1.List all the movies and draw the bar graph using
turtle')
choice = int(input('Enter your choice: '))
if choice == 0:
menu()
elif choice == 1:
displaydata()
else:
print('Wrong option entered,\nBye!!')
exit(0)
if __name__ == "__main__":
menu() # calling the main function
Need a program in python. Asterix and Obelix want to store and process information about movies...
For Python 3.8! Copy and paste the following bolded code into IDLE: movies = [[1939, 'Gone with the Wind', 'drama'], [1943, 'Casablanca', 'drama'], [1965, 'The Sound of Music', 'musical'], [1969, 'Midnight Cowboy', 'drama'], [1972, 'The Godfather', 'drama'], [1973, 'The Sting', 'comedy'], [1977, 'Annie Hall', 'comedy'], [1982, 'Ghandi', 'historical'], [1986, 'Platoon', 'action'], [1990, 'Dances with Wolves', 'western'], [1992, 'Unforgiven', 'western'], [1994, 'Forrest Gump', 'comedy'], [1995, 'Braveheart', 'historical'], [1997,...
This homework problem has me pulling my hair out. We are working
with text files in Java using NetBeans GUI application. We're
suppose to make a movie list and be able to pull up movies already
in the text file (which I can do) and also be able to add and
delete movies to and from the file (which is what I'm having
trouble with). I've attached the specifications and the movie list
if you need it. Any help would...
Must be done in python and using linux mint
Write a program to create a text file which contains a sequence of test scores. Each score will be between 0 and 100 inclusive. There will be one value per line, with no additional text in the file. Stop adding information to the file when the user enters -1 The program will first ask for a file name and then the scores. Use a sentinel of -1 to indicate the user...
WONT COMPILE ERROR STRAY / TEXT.H AND CPP PROGRAM SAYING NOT DECLARED HAVE A DRIVER WILL PASTE AT BOTTOM MOVIES.CPP #include "movies.h" #include "Movie.h" Movies *Movies::createMovies(int max) { //dynamically create a new Movies structure Movies *myMovies = new Movies; myMovies->maxMovies = max; myMovies->numMovies = 0; //dynamically create the array that will hold the movies myMovies->moviesArray = new Movie *[max]; return myMovies; } void Movies::resizeMovieArray() { int max = maxMovies * 2; //increase size by 2 //make an array that is...
Python Subject
Output in Thonny ot IDLE
Description
Create a program that keeps track of the items that a wizard can
carry.
Sample Output (Your output should be similar to the text
in the following box)
The Wizard Inventory program
COMMAND MENU
walk - Walk down the path
show - Show all items
drop - Drop an item
exit - Exit program
Command: walk
While walking down a path, you see a scroll of uncursing.
Do you want to grab...
I need help on these functions PYTHON 3. The information about
the functions is in the first two pics.
Scenario The Pokemon franchise consists of over 60 video games, 15 movies, several TV shows, a trading card game, and even a musical. It has been around for over two decades and at this point has fans of all ages. Because of this, people have become somewhat analytical about how they play the games. To help players of the Pokemon video...
In C++
Write a menu driven C++ program to read a file containing
information for a list of Students, process the data, then present
a menu to the user, and at the end print a final report shown
below. You may(should) use the structures you developed for the
previous assignment to make it easier to complete this assignment,
but it is not required.
Required Menu Operations are:
Read Students’ data from a file to update the list (refer to
sample...
23.4 Project 4: Using Pandas for data analysis and practice with
error handling
Python Please!
23.4 PROJECT 4: Using Pandas for data analysis and practice with error handling Overview In this project, you will use the Pandas module to analyze some data about some 20th century car models, country of origin, miles per gallon, model year, etc. Provided Input Files An input file with nearly 200 rows of data about automobiles. The input file has the following format (the same...
For this c++ assignment, Overview write a program that will process two sets of numeric information. The information will be needed for later processing, so it will be stored in two arrays that will be displayed, sorted, and displayed (again). One set of numeric information will be read from a file while the other will be randomly generated. The arrays that will be used in the assignment should be declared to hold a maximum of 50 double or float elements....