Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Entry
- age = ''
- count = 0
- total = 0
- # Process
- while age != -1:
- age = int(input("Type the age of the citizen or type -1 to close the program:"))
- if age != -1:
- total += 1
- sex = int(input("Type 1 if the citizen is female\nType 2 if the citizen is male:"))
- if sex == 1 and age <= 35 and age >= 18:
- count += 1
- # Output
- if count == 0:
- print("The percentage of women between 18 and 35 in the city is 0%")
- else:
- percentage = count / total * 100
- print("The percentage of women between 18 and 35 in the city is", percentage, "%")
Advertisement
Add Comment
Please, Sign In to add comment