1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Nookie1986 [14]
3 years ago
13

Create a text file that contains your expenses for last month in the following categories: • Rent • Gas • Food • Clothing • Car

payment • Misc Write a Python program that reads the data from the file and uses matplotlib to plot a pie chart showing how you spend your money

Computers and Technology
1 answer:
ololo11 [35]3 years ago
3 0

Answer:

Check the explanation

Explanation:

Code:

import matplotlib.pyplot as plt

filename = input('Enter the name of file : ')

# open file in read mode

fptr = open(filename , 'r')

# set the labels

categories = [ 'Rent', 'Gas', 'Food', 'Clothing', 'Car Payment', 'Misc' ]

# store the expenses in the order of labels

expenses = []

# read the content of file

strng = fptr.read()

# read the file line by line

for line in strng.split('\n'):

   # add the current expense to expenses

   expenses.append( int( line ) )

colors = ['gold', 'yellowgreen', 'lightcoral', 'lightskyblue', 'green', 'red']

# plot the pie chart

plt.pie(expenses, labels = categories, colors = colors, autopct='%1.1f%%', shadow=True, startangle=140)

# set the axis as equsl

plt.axis('equal')

# display the chart

plt.show()

------------------------------input.txt--------------------------

1000

235

5600

800

480

758

Kindly check the attached output image below.

You might be interested in
There are _______ bits to every byte.
MrMuchimi

8. according to Google, 1 byte = 8 bits

7 0
2 years ago
Read 2 more answers
Using a "word" of 5 bits, list all of the possible signed binary numbers and their decimal equivalents that are represent able i
Vsevolod [243]

Answer:

i). Signed magnitude

Five bit representation = 11111

For positive 5 bit representation = 01111 = +15

For negative 5 bit representation = 11111 = -15

ii). One's complement

For positive 5 bit representation = 01111 =+15

For negative 5 bit representation = 10000 = -15

iii). Two's compliment

For positive 5 bit representation = 01111 = -15

For negative 5 bit representation = 10001 = +15

7 0
2 years ago
Your company is trying to get out of the responsibility of purchasing and hosting its own hardware so it won’t have to finance o
kotykmax [81]
The answer is Software as a Service (SaaS).

SaaS is one of the 3 main categories of cloud computing. In SaaS, a 3rd party provider hosts applications and make them available to customers over the internet. It removes the need for businesses to install and run applications on their own data centers or computers. It also eliminates the expense of hardware acquisition and maintenance, as well as software installation and support.
7 0
3 years ago
Read 2 more answers
3. Radheshree has to complete her assignment and submit it on the next day. While typing
Dafna1 [17]

Answer:

she can use the onscreen keyboard

this application is present in accessories file in the windows

5 0
2 years ago
Is techonology better? Lot of votes needed.
Nataliya [291]
In some ways yes but others... not so much. we have access to amazing things that can help so many people and some are tearing people apart or are used for illegal things. its really everyone's own opinion because of some interactions (positive or negative) that can influence them.
5 0
3 years ago
Other questions:
  • . What physical characteristic does a retinal scan biometric device measure?
    8·1 answer
  • Which web browser below is natively available on a major operating system? ie 10 opera firefox chrome?
    12·1 answer
  • The array s of ints contain integers each of which is between 1 and 1000 (inclusive). write code that stores in the variable ord
    9·1 answer
  • What data discovery process, whereby objects are categorized into predetermined groups, is used in text mining?
    9·1 answer
  • Which element appears within the top margin of the document but does not form the part of the body of the text?
    15·1 answer
  • (25 POINTS) Some applications work on all devices while others work on some devices. True or False?
    13·1 answer
  • A motor is controlled by a logic circuit. The circuit has inputs (0 or 1) from three sensors
    8·1 answer
  • Explain
    6·1 answer
  • OI MINHA PRIMEIRA VEZ AQUI
    7·1 answer
  • Many people are scared of the rise of Artificial Intelligence (AI). Do you think computers that are controlled by an AI are some
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!