I'm having difficulty starting a while loop trying to generate a program that will generate a pie chart or bar graph from numbers that a user will input. How does the while loop need to be written so it's not looping forever? I know I could use a for loop for a finite sequence but i'm not too experienced in that. any guidance would be helpful!
from SimpleGraphics import *
print("Chart Menu: 1.Pie Chart, 2.Bar Chart")
chart = int(input("enter either 1 for pie chart or 2 for bar chart:"))
if chart == 1:
title = input("Enter the title of the chart: ")
numSec = int(input("Enter the number of sectors: "))
tSum = int(input("Enter the total sum of all sector values: "))
gsize = int(input("Ehter the grid size (Between 10 and 400): "))
yLabel = input("Enter the label for the Y-Axis:")
while loop
-the name of each sector
-the value each sector
-draw pie chart
if chart == 2:
title = input("Enter the title of the chart: ")
numCat = int(input("Enter the number of categories: "))
grid = int(input("Ehter the grid size (Between 10 and 400): "))
while loop
-name of each category
-value for that category
-draw bar graph
Aucun commentaire:
Enregistrer un commentaire