Question: Using Python! Without any loops. 4. Sum the digits of an integer. Read in an integer between 0 and 999, add all of the individual
4. Sum the digits of an integer. Read in an integer between 0 and 999, add all of the individual digits of the integer and display the result. (Hint: Use the % operator to extract digits, for instance, 932 % 10 = 2. And use the // operator to remove the extracted digit, for instance 932 // 10 = 93.) Here is a sample run: Enter a number between 0 and 999: 999 The sum of the digits is 27 5. Population projection. The US Census Bureau projects population based on the following assumptions: a. One birth every 7 seconds b. One death every 13 seconds C. One new immigrant every 45 seconds Display the population for each of the next 5 years, given the current population. Assume one year has 365 days. (Hint: You can use integer division // to avoid ending up with fractions of people.) Here is a sample run: Enter the current population: 312032486 The population in 1 year will be: 314812582 The population in 2 years will be: 317592678 The population in 3 years will be: 320372774 The population in 4 years will be: 323152870 The population in 5 years will be: 325932966
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
