Question

Write an if/else statement that adds 1 to minors if age is less than 18, adds...

Write an if/else statement that adds 1 to minors if age is less than 18, adds 1 to adults if age is 18 through 64 and adds 1 to seniors if age is 65 or older.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
if age < 18:
    minors += 1
elif age <= 64:
    adults += 1
else:
    seniors += 1
Add a comment
Know the answer?
Add Answer to:
Write an if/else statement that adds 1 to minors if age is less than 18, adds...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write in C: 1.) Write an if/else statement that adds 1 to the variable minors if...

    Write in C: 1.) Write an if/else statement that adds 1 to the variable minors if the variable age is less than 18, adds 1 to the variable adults if age is 18 through 64, and adds 1 to the variable seniors if age is 65 or older. 2.) Write a statement that compares the values of score1 and score2 and takes the following actions. When score1 exceeds score2, the message "player1 wins" is printed to standard out. When score2...

  • Use only C++ languages, please!!! Assume: int age; int minors = 0; int adults = 0;...

    Use only C++ languages, please!!! Assume: int age; int minors = 0; int adults = 0; int seniors = 0; Write an if/else statement that adds 1 to the variable minors if the variable age is less than 18, adds 1 to the variable adults if age is 18 through 64 inclusive, and adds 1 to the variable seniors if age is 65 or older.

  • This is Visual Basics... Write an if/else statement that assigns true to the variable fever if...

    This is Visual Basics... Write an if/else statement that assigns true to the variable fever if the variable temperature is greater than 98.6; otherwise it assigns false to fever.* Write an if/else statement that adds 1 to the variable minors if the variable age is less than 18, adds 1 to the variable adults if age is 18 through 64 and adds 1 to the variable seniors if age is 65 or older.*

  • Python Write if/else code that adds one to the variable adults if the value of age...

    Python Write if/else code that adds one to the variable adults if the value of age is greater or equal to 18, and adds one to the variable minors otherwise.

  • Refer to Figure 20-4. In 1968, the percent of children under age 18 in poverty is...

    Refer to Figure 20-4. In 1968, the percent of children under age 18 in poverty is Figure 20-4 Poverty Rates by Age Figure 2. Poverty Rates by Age: 1959 to 2001 Percent Recession 65 years and over Under 18 years 16.3 percent 10.1 percent 10.1 percent 18 to 64 years 1959 1965 1970 1975 1980 1990 1995 2001 Note: The data points represent the midpoints of the respective years. The latest recession began in March 2001. Data for people 18...

  • EXERCISES: if & if...else STATEMENTS: Name Examples of if and if-else statements: Write an if statement...

    EXERCISES: if & if...else STATEMENTS: Name Examples of if and if-else statements: Write an if statement that multiplies payRate by 1.5 iſ hours is greater than 40. Write variable declarations for the variables payRate and hours first. Hint: Look for keyword if first, your boolean comes after the keyword [. This translates into Java as: double hours, payRate; if (hours > 40) { //{-} are optional here but I recommend that you them payRate = payRate 1.5; pay Rato pay...

  • QUESTION 1 8 Age <18 22 6% 22 3% Poverty rates by age and gender Age...

    QUESTION 1 8 Age <18 22 6% 22 3% Poverty rates by age and gender Age 18-64 12.0% . 15.3% SRK 11 / / Rank the following from one to six) in order of the relative poverty (six has the highest poverty rate and one has the lowest). / Female adults (ages 18-64) - Male children (under 18) - Female elderly (over 64) - Male adults (ages 18-64) Female children (under 18) Male elderly (over 64)

  • Use the table to the​ right, which shows the age distribution of those who earned less...

    Use the table to the​ right, which shows the age distribution of those who earned less than minimum wage in a recent year. If a worker is randomly selected from those​ surveyed, what is the probability that the person is younger than 65? Age Working Below Minimum Wage​ (thousands) ​16-19 323 ​20-24 438 ​25-34 325 ​35-44 187 ​45-54 119 ​55-64 55 65 and older 39

  • Problem 5. The US Bureau of Labor Statist under age 65 was between 18 and 24...

    Problem 5. The US Bureau of Labor Statist under age 65 was between 18 and 24 years of age, 28% was between 25 and 34, 19% was betweenn 35 and 44, and 32% was between 45 and 64 n 1982, an automobile manufacturer wanted to obtain opinions on a new de five randomly chosen adults from the under-65 group of adults. Of the five people selected, find the approximate ics reported that, as of 1981 , approximately 21% of the...

  • Part 2 of 3 ELUC (b) What is the probability than an asthma patent is 85...

    Part 2 of 3 ELUC (b) What is the probability than an asthma patent is 85 years old pr older? The probability that an asthma patient is 85 years old or older 16.763 numa 4.0419 409,126 Part 3 of 3 (c) Using a cutoff of 0.05, is it unusual for an asthma patient to be less than 1 year old? Based on a cutoff of 0.05, it Choose re u nusual for an asthma patient to be less than 1...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT