It is to be noted that testing a self-driving car prototype on various types of roadways, such as a racetrack, hill rack, and dirt road, can be considered fair practice. It would only be unfair practice if the lives and property of humans are put at risk during the testing.
What is unfair practice?Unfair practices are behaviors that are neither just or fair. It would be deemed unjust to treat someone differently because of their color or gender, for example. Cheating or violating regulations to get an edge over others is also included. To develop a fair and just society, it is critical to constantly treat people with fairness and respect.
In this scenario, it is evident that endangering human life and property is unethical behavior.
Learn more about Unfair Practices:
https://brainly.com/question/14700715
#SPJ1
Which of the following statements is a possible explanation for why open source software (OSS) is free? A. OSS makes money by charging certain large corporations for licenses. B. OSS is typically lower quality than proprietary software. C. The OSS movement wants to encourage anyone to make improvements to the software and learn from its code. D. The OSS movement is funded by a private donor so it does not need to charge for its software licenses.
The statement that represents a possible explanation for why open-source software (OSS) is free is as follows:
The OSS movement is funded by a private donor so it does not need to charge for its software licenses.Thus, the correct option for this question is D.
What is open-source software?Free and open-source software (FOSS) is a term used to refer to groups of software consisting of both free software and open-source software where anyone is freely licensed to use, copy, study, and change the software in any way, and the source code is openly shared so that people are encouraged to voluntarily improve.
Open-source software (OSS) is computer software that is released under a license in which the copyright holder grants users the rights to use, study, change, and be marked by the user for a specific purpose in order to perform particular functions.
Therefore, the correct option for this question is D.
To learn more about Open-source software, refer to the link:
https://brainly.com/question/15039221
#SPJ1
Assignment 3: Chatbot
What the code for assignment 3: chatbot Edhesive.
Coding is difficult but I don't have a chatbot
Answer:
import random
# Introduction
print("Welcome to the fashion chatbot! I'm here to help you with your fashion preferences.")
# Ask for user's first name
print("What is your first name?")
name = input()
# Ask for user's shoe preference
print("What shoes do you like?")
shoe_preference = input()
# Use if-elif-else statement to respond to user's shoe preference
if shoe_preference == "Converse":
print("Nice, casual is always in!")
elif shoe_preference == "Boots":
print("Cool, boots are a versatile choice.")
else:
print("Great choice!")
# Ask for user's age
print("How old are you?")
age = input()
# Use if-elif-else statement to respond to user's age
if int(age) < 18:
print("It's a great time to start exploring your style!")
elif int(age) < 25:
print("You're at a fun age to experiment with your fashion choices.")
else:
print("It's always a good time to try out new fashion styles!")
# Use a randomly generated number to randomly respond
random_number = random.randint(1, 3)
if random_number == 1:
print("I think I might know your style.")
elif random_number == 2:
print("You have a unique sense of style.")
else:
print("You have great fashion taste.")
# Ask for user's favorite top
print("So, " + name + ", what is your favorite top?")
top_preference = input()
# Use if-elif-else statement to respond to user's top preference
if top_preference == "Graphic Tees":
print("That's a good choice.")
elif top_preference == "Button-up shirts":
print("Classy and sophisticated.")
else:
print("Great choice!")
# Use a randomly generated number to randomly respond
random_number = random.randint(1, 3)
if random_number == 1:
print("Ay that's lit.")
elif random_number == 2:
print("wow, so stylish!")
else:
print("That's in right now.")
# Ask for user's bottom preference
print("I like where this is going.")
print("What about your choice of bottom?")
bottom_preference = input()
# Use if-elif-else statement to respond to user's bottom preference
if bottom_preference == "Jeans":
print("Jeans are a classic choice.")
elif bottom_preference == "Cargo pants":
print("You can't go wrong with those.")
else:
print("Great choice!")
# Ask for user's head accessory preference
print("What about your head accessory?")
head_accessory_preference = input()
# Use if-elif-else statement to respond to user's head accessory preference
if head_accessory_preference == "Beanies":
print("Beanies are fun!")
elif head_accessory_preference == "Baseball hats":
print("Baseball hats are a popular choice.")
else:
print("Unique choice!")
# End conversation
print("Well, " + name + ", it was awesome getting to know your style.")
Which company gave Apple its big break in the business market?
Commodore Business Machines
Software Arts
Tandy Corporation
Microsoft
Answer:
Microsoft
Explanation: I’m not a computer fanatic, but everybody should know this. And if anything else is the answer, then that’s because it would’ve been in the text that I DON’T have.
Answer: software arts
Explanation:
i just did it
To insert a new column to left of a specific column right click the header containing the columns letter and select
To insert a new column to the left of a specific column, right-click the header containing the column's letter and select simply right-click on any cell in a column, right-click and then click on Insert.
What is inserting columns?By doing so, the Insert dialog box will open, allowing you to choose "Entire Column." By doing this, a column would be added to the left of the column where the cell was selected.
Go to Home > Insert > Insert Sheet Columns or Delete Sheet Columns after selecting any cell in the column. You might also right-click the column's top and choose Insert or Delete.
Therefore, to insert a column, right-click the header containing the column's letter.
To learn more about inserting columns, refer to the link:
https://brainly.com/question/5054742
#SPJ1
Write the Holiday Date of the following holidays:
1. Bonifacio Day –
2. Christmas Day –
3. Rizal Day –
4. Day of Valor –
5. Labor Day –
6. Independence Day –
7. New Year’s Day –
8. People Power Day –
9. Ninoy Aquino Day –
10. All Saint’s Day –
Answer:
1. November 30
2. December 25
3. December 30
4. April 9
5. September 1
6. (depends)
7. January 1
8. February 25
9. August 21
10. November 1
Explanation:
Code to be written in python:
Correct answer will get brainliest :)
Mr Wu has been going to work every day by taxi for many years. However, the taxi fare has been increasing rather quickly in recent years. Therefore, he is considering driving to work instead. One of the costs for driving is the parking fee. The parking rates of the car park at Mr Wu's workplace are as shown as below:
Weekdays:
$2 per hour between 4am and 7am
$1.20 per half hour between 7am and 6pm
$5 per entry after 6pm
Saturdays:
$2.50 per hour between 4am and 7am
$1.50 per half hour between 7am and 6pm
$7 per entry after 6pm
Sunday: Flat rate of $5 per entry
For all days, there is a grace period of 10 minutes.
The car park opens between 4am and 12 midnight daily. We assume vehicles are magically ejected at midnight.
There is a 10% surcharge on weekdays and a 20% surcharge on Saturdays for vehicles who park for more than 10 hours. There are no surcharges on Sunday.
There is an additional fee of $3 for exiting after 10pm on any day.
Your task is to write a function compute_fee(day, time_in, time_out) that computes the parking fee, where day is an integer between 1 and 7, with 7 representing Sunday, while time_in and time_out are integer values in a 24-hour format - e.g. 700 for 7am and 2359 for 11:59pm. Assume all input is valid.
Below are a few examples of how the fee is calculated:
Example 1: Tuesday, 4:29am to 7:50am.
• 4:29am to 7am is charged as 3 1-hour slots: $2.00 * 3 = $6.00
• 7am to 7:50am is charged as 2 30-minute slots: $1.20 * 2 = $2.40
• Total fee = $6.00 + $2.40 = $8.40
Example 2: Saturday, 7:01am to 7:49pm.
• 7:01am to 6pm is charged as 22 30-minute slots: $1.50 * 22 = $33.00
• 6pm to 7:49pm is charged as one entry: $7.00
• 20% Surcharge for parking more than 10 hours: ($33.00 + $7.00) * 20% = $8.00
• Total fee = $33.00 + $7.00 + $8.00 = $48.00
Example 3: Sunday, 3pm to 10:01pm.
• 3pm to 10:01pm is charged as one entry: $5.00
• Additional fee for exiting after 10pm: $3.00
• Total fee = $5.00 + $3.00 = $8.00
Example 4: Thursday, 11:49pm to 11:59pm.
• Grace period
• Total fee = $0.00
Example 5: Monday, 12pm to 10:01pm.
• 12pm to 6pm is charged as 12 30-minute slots: $1.20 * 12 = $14.40
• 6pm to 10:01pm is charged as one entry: $5.00
• 10% Surcharge for parking more than 10 hours: ($14.40 + $5.00) * 10% = $1.94
• Additional fee for exiting after 10pm: $3.00
• Total fee = $14.40 + $5.00 + $1.94 + $3.00 = $24.34
def compute_fee(day, time_in, time_out):
"""Your code here"""
Test Cases:
compute_fee(2, 429, 750) 8.4
compute_fee(6, 701, 1949) 48
compute_fee(7, 1500, 2201) 8
compute_fee(4, 2259, 2301) 0
compute_fee(1, 1200, 2201) 24.34
Here is the requested Python function that computes the parking fee based on the given information:
Write a Java program that have ten integral values into an array namely List. Your program
should have a menu to select/perform the following functions :-
lnsert ( ) - accept a value into the array if it's not full
Remove ( ) - remove a value from an array if it's not empty based on user selection
Search ( ) - Return the numbers of the particular search value
lncrease ( ) - lncrease the percentage of the store value based onto the input percentage
Update ( ) - Edit the existing value choose by user.
This type of network may not be connected to other networks.
A) LAN
B) MAN
C) WAN
Answer:
LAN
Explanation:
brainliest?:(
Answer:
A) LAN (Local Area Network)
Which computers were the first PCs with a GUI
MS-DOS
Linux
Windows
Mac
The earliest GUI-equipped PCs were Linux and Mac-based. These are the right answers to the question that was asked.
Which PCs had a graphical user interface (GUI) first?The first computer to employ a mouse, the desktop metaphor, and a graphical user interface (GUI), concepts Douglas Engelbart first introduced while at International, was the Xerox Alto, developed at Xerox PARC in 1973. It was the first instance of what is now known as a full-fledged personal computer.
When was the GUI added to Windows?Windows is based on what is known as a graphical user interface (GUI), which was created by Xerox in 1975 but was never used. The "window, icon, menu, and pointing device" (WIMP) combination will make up the majority of a typical GUI.
To learn more about GUI visit:
brainly.com/question/14758410
#SPJ1
Describe your academic and career plans and any special interests (e.g., undergraduate research, academic interests, leadership opportunities, etc.) that you are eager to pursue as an undergraduate at Indiana University. If you encountered any unusual circumstances, challenges, or obstacles in completing your education, share those experiences and how you overcame them.
Answer:
My academic and career plans are to pursue an undergraduate degree in business and minor in accounting. I am particularly interested in the finance, marketing, and management fields. After graduating, I plan to go on to pursue a Master's degree in Business Administration.
I am eager to pursue leadership opportunities at Indiana University, and would like to become involved in the student government. I am also interested in participating in undergraduate research, and exploring the possibilities of internships or other professional development experiences. Finally, I am looking forward to getting involved in extracurricular activities, such as clubs and organizations, to gain a better understanding of the business field and to network with other students and professionals.
Throughout my educational journey, I have had to overcome a few obstacles that have been made more difficult due to the pandemic. I have had to adjust to a virtual learning environment and find new ways to stay engaged in my classes. Additionally, I have had to learn how to manage my time more efficiently, which has been challenging due to the fact that I am also working part-time. Despite these difficulties, I have been able to stay motivated by setting goals and prioritizing my work. With determination and perseverance, I am confident that I can achieve my academic and career goals.
Question 2
An example of something that operates at the application layer is:
Answer:
HTTP, FTP, SMTP- These are protocols at the application layer
Explanation:
Write a java program that asks the student for his name and the month in which he/she was born. Students are then divided into sections, according to the following: Section A: Name starts between A - E Born between months 1 - 6 Section B: Name starts between F - L Born between months 1 - 6 Section C: Name starts between M - Q Born between months 7 - 12 Section D: Name starts between R - Z Born between months 7 - 12
Answer:
import java.util.Scanner;
public class SectionAssignment {
public static void main(String[] args) {
// Create a scanner object to read input
Scanner input = new Scanner(System.in);
// Prompt the student for their name
System.out.print("Enter your name: ");
String name = input.nextLine();
// Prompt the student for the month they were born
System.out.print("Enter the month you were born (1-12): ");
int month = input.nextInt();
// Assign the student to a section based on their name and birth month
String section = "";
if (name.charAt(0) >= 'A' && name.charAt(0) <= 'E' && month >= 1 && month <= 6) {
section = "A";
} else if (name.charAt(0) >= 'F' && name.charAt(0) <= 'L' && month >= 1 && month <= 6) {
section = "B";
} else if (name.charAt(0) >= 'M' && name.charAt(0) <= 'Q' && month >= 7 && month <= 12) {
section = "C";
} else if (name.charAt(0) >= 'R' && name.charAt(0) <= 'Z' && month >= 7 && month <= 12) {
section = "D";
} else {
section = "Invalid";
}
// Print the student's section assignment
System.out.println("Your section is: " + section);
}
}
Type the program's output states = ['CA', 'NY', 'TX', 'FL', 'MA'] for (position, state) in enumerate(states): print(state, position)
Answer:
states = ['CA', 'NY', 'TX', 'FL', 'MA']
for (position, state) in enumerate(states):
print(state, position)
Output:
CA 0
NY 1
TX 2
FL 3
MA 4
You are a member of Future Business Leaders of America, and a local retirement community has asked if you and
your other members could come to their facility to help teach the residents that live there how to use technology
so that they can communicate with their grandchildren. This is an example of
networking
a competition
community service
a class assignment
Senior executives typically invite network members to participate in the planning and implementation of the change process at the first meeting. There is a matter of minutes, and Meetings are scheduled frequently.
Which three strategies would you recommend to make your company a fantastic place to work?Fantastic lines of communication between management and employees. a feeling of belonging within the crew. allowing workers the freedom to develop their skills. a tradition of ongoing development.
What are some tactics you may employ to promote innovation and creativity within a company?Ask your staff to present their ideas if you want to encourage creativity and innovation. You might also develop a procedure to submit them. Request that each employee presents an idea within a set deadline, and offer incentives to encourage discussion.
to know more about community service here:
brainly.com/question/15862930
#SPJ1
In the acronym, MS-DOS, DOS stands for which option?
Digital Operating System
Disk Operating System
Dynamic Operating System
Distributed Operating System
Answer:
Disk Operating System
Explanation:
A table student consists of 5 rows and 7 columns. Later on 3 new attributes are added and 2 tuples are deleted. After some time 5 new students are added. What will be the degree and cardinality of the table?
Answer:
The degree of a table refers to the number of attributes (columns) it has. In the case you described, after the 3 new attributes are added, the degree of the table would be 7 + 3 = 10.
The cardinality of a table refers to the number of rows (tuples) it has. In the case you described, after 2 tuples are deleted, the cardinality of the table would be 5 - 2 = 3. After 5 new students are added, the cardinality would increase to 3 + 5 = 8.
To protect your online privacy, you should not?
A. be careful when talking to strangers online.
B. use an antivirus software.
C. download updates for mobile devices and computers.
D. use the same password for every account.
Answer:
Your answer to this will be D) Use the same password for every account.
Explanation:
This is the only option you should not do. If someone gets access or hacks into one of your accounts, and all accounts to anything are the same password they will have all of your accounts.
Which of the following are numbers and text that do not change unless manually altered?
equal sign
references
constants
mathematical operators
Answer:
constants are numbers and text that do not change unless manually altered.
Answer: c
Explanation:
My code doesn't give me the right output: I have to use the Python input command, and the number could be a decimal fraction, such as 6.5, so I should use floating point numbers?
I need to have a loop that repeats six times, with a routine in the middle of the loop to get the user input as a floating point number and add the number to a sum.
Can someone check it for me?
score_list = [ input("Judge No {} :score ".format(num+1)) for num in range(6)]
int_accumilator :int = 0
for score in score_list:
if(score > 10 ):
print("i only like numbers within the 0-10 range !")
exit()
int_accumilator+= score
print("the average score is ...", int_accumilator/ len(score_list))
Answer:
def get_score(judge_num: int) -> float:
"""
Asks the user for the score of a single judge and returns it.
"""
score = float(input(f"Score for Judge {judge_num}: "))
return score
def calculate_average(scores: list[float]) -> float:
"""
Calculates the average score given a list of scores.
"""
return sum(scores) / len(scores)
# Initialize the total score to 0
total_score = 0
# Initialize an empty list to store the scores of the judges
scores = []
# Loop through each judge
for judge_num in range(1, 7):
# Get the score for the current judge
score = get_score(judge_num)
# Add the score to the total score
total_score += score
# Append the score to the list of scores
scores.append(score)
# Calculate the average score
average_score = calculate_average(scores)
# Print the average score
print(f"The average score is: {average_score:.2f}")
What benefit do internal networked e-mail systems provide over Internet-based systems?
A) They enable the transmission of videos.
B) They allow e-mail to be sent to coworkers.
C) They allow files to be shared by sending attachments.
D) They provide increased security.
Answer:
The correct answer is D) They provide increased security.
Code to be written in python:
Correct code will automatically be awarded the brainliest
You had learnt how to create the Pascal Triangle using recursion.
def pascal(row, col):
if col == 1 or col == row:
return 1
else:
return pascal(row - 1, col) + pascal(row - 1, col - 1)
But there is a limitation on the number of recursive calls. The reason is that the running time for recursive Pascal Triangle is exponential. If the input is huge, your computer won't be able to handle. But we know values in previous rows and columns can be cached and reused. Now with the knowledge of Dynamic Programming, write a function faster_pascal(row, col). The function should take in an integer row and an integer col, and return the value in (row, col).
Note: row and col starts from 1.
Test Cases:
faster_pascal(3, 2) 2
faster_pascal(4, 3) 3
faster_pascal(100, 45) 27651812046361280818524266832
faster_pascal(500, 3) 124251
faster_pascal(1, 1) 1
def faster_pascal(row, col):
if (row == 0 or col == 0) or (row < col):
return 0
arr = [[0 for i in range(row+1)] for j in range(col+1)]
arr[0][0] = 1
for i in range(1, row+1):
for j in range(1, col+1):
if i == j or j == 0:
arr[i][j] = 1
else:
arr[i][j] = arr[i-1][j] + arr[i-1][j-1]
return arr[row][col]
he assessment you are doing lives in the cloud. The program that grades it and saves your score lives in the cloud. Who might need to apply
atches to this software? Select three options.
The school is responsible for updating computers in its computer lab if you work at school.
It depends on the operating system you are using. Some operating systems do not do updates.
Updates known as patches are made available by both hardware producers and software developers (of both operating systems and applications).
What do patches mean?Operating system (OS) and software patches are updates that address security holes in a program or product. Updates may be released by software developers to fix performance problems and include better security features.
Why are software patches and updates necessary?Updates can improve application functionality and compatibility while mitigating security holes. The continued operation of computers, mobile devices, and tablets depends on software upgrades. They might also lessen security flaws. Data breaches, hacking, and identity theft have all lately hit the news.
To know more about software visit:-
https://brainly.com/question/985406
#SPJ1
4.3 lesson practice phython
Answer:
user input loop
count variable
user input
Explanation:
these are you answers
The user is able to input grades
and their weights, and calculates the overall final mark. The program should also output what you need to achieve on a specific assessment to achieve a desired overall mark. The program should be able to account for multiple courses as well. Lists are allowed.
Name of person
Number of courses
Course ID
Grades and Weights in various categories (Homework, Quiz, and Tests)
Enter grades until -1 is entered for each category
Final Grade before exam
Calculate to get a desired mark (using final exam)
Output all courses
Answer:
Here is an example of how you could write a program to perform the tasks described:
# Store the student's name and number of courses
name = input("Enter the student's name: ")
num_courses = int(input("Enter the number of courses: "))
# Create an empty list to store the course data
courses = []
# Loop through each course
for i in range(num_courses):
# Input the course ID and initialize the total grade to 0
course_id = input("Enter the course ID: ")
total_grade = 0
# Input the grades and weights for each category
print("Enter grades and weights for each category (enter -1 to finish)")
while True:
category = input("Enter the category (homework, quiz, test): ")
if category == "-1":
break
grade = int(input("Enter the grade: "))
weight = int(input("Enter the weight: "))
# Calculate the contribution of this category to the total grade
total_grade += grade * weight
# Store the course data in a dictionary and add it to the list
course_data = {
"id": course_id,
"grade": total_grade
}
courses.append(course_data)
# Input the final grade before the exam
final_grade_before_exam = int(input("Enter the final grade before the exam: "))
Code practice
Write a program that will ask a user how many numbers they would like to check. Then, using a for loop, prompt the user for a number, and output if that number is divisible by 3 or not. Continue doing this as many times as the user indicated. Once the loop ends, output how many numbers entered were divisible by 3 and how many were not divisible by 3.
Sample Run :
How many numbers do you need to check? 5
Enter number: 20
20 is not divisible by 3.
Enter number: 33
33 is divisible by 3.
Enter number: 4
4 is not divisible by 3.
Enter number: 60
60 is divisible by 3.
Enter number: 8
8 is not divisible by 3.
You entered 2 number(s) that are divisible by 3.
You entered 3 number(s) that are not divisible by 3.
Answer:
n = int(input("How many numbers would you like to check? "))
divisible_count = 0
not_divisible_count = 0
for i in range(n):
num = int(input("Enter a number: "))
if num % 3 == 0:
print(str(num) + " is divisible by 3")
divisible_count += 1
else:
print(str(num) + " is not divisible by 3")
not_divisible_count += 1
print("You checked " + str(n) + " numbers.")
print("Of those, " + str(divisible_count) + " were divisible by 3.")
print("And " + str(not_divisible_count) + " were not divisible by 3.")
Explanation:
You would run the program, it will ask the user to enter a number of integers, to check after that it will ask to enter numbers one by one, for each input, it will check if it's divisible by 3 or not, and keep counting how many were divisible or not divisible. After the loop ends, the program will output a summary of the total numbers checked, how many of them were divisible by 3 and how many were not.
You may further adjust it to match the requirement you need
Create a program for the given problems using one-dimensional array. Program to identify if the input number is odd or even.
Answer:
Here's an example of a simple program in Python that uses a one-dimensional array to determine if a given number is odd or even:
def check_odd_even(arr):
for i in range(len(arr)):
if arr[i] % 2 == 0:
print(str(arr[i]) + " is even")
else:
print(str(arr[i]) + " is odd")
# Example usage
numbers = [1, 2, 3, 4, 5, 6, 7]
check_odd_even(numbers)
The program defines a function check_odd_even that takes an array of numbers as an input. It then iterates over the array, checking the remainder of each number when divided by 2. If the remainder is 0, the number is even, if not then it is odd. The program then prints whether each number is even or odd.
You can input any array you want, of any lenght, and the function will work the same way.
Keep in mind that you can also check the parity in another ways, like using bitwise operation.
Explanation:
Workstations are usually applied for scientific, mathematical, and engineering calculations and computer aided-design and computer aided- manufacturing. a. False b. True
Workstations are usually applied for scientific, mathematical, and engineering calculations and computer aided-design and computer aided- manufacturing is True
What is Workstations?Workstations are specialized computers that are designed for high-performance and resource-intensive tasks such as scientific, mathematical, and engineering calculations, computer-aided design (CAD), and computer-aided manufacturing (CAM).
Therefore, They typically have faster processors, more memory, and better graphics capabilities than general-purpose computers, which allows them to handle the complex tasks required in these fields.
Learn more about Workstations from
https://brainly.com/question/9958445
#SPJ1
What is the difference between a baseline and an objective?
A baseline is a start, and an objective is an ending.
A baseline is measurable, and an objective is not measurable.
A baseline is a start, and an objective shows progression.
A baseline is a benchmark, and an objective is an ending.
The difference between a baseline and an objective is a baseline is a start, and an objective is an ending. Therefore, option A is correct.
What is the objective of baseline?Regardless of the study topic, a baseline study is a descriptive cross-sectional survey that primarily offers quantitative data on the current condition of a specific situation in a given population. It seeks to quantify how various variables are distributed over time within a study population.
A baseline is a constant point of comparison that is employed in comparison studies. In business, a project's or product's success is frequently evaluated in comparison to a baseline figure for expenses, sales, or any other number of factors. A project may go over or under its predetermined benchmark.
Thus, option A is correct.
To learn more about the objective of baseline, follow the link;
https://brainly.com/question/15018074
#SPJ1
Start with a population of 500 organisms, a growth rate of 2, and a growth period to achieve this rate of 6 hours. Assuming that none of the organisms die, this would imply that this population would double in size every 6 hours. Thus, after allowing 6 hours for growth, we would have 1000 organisms, and after 12 hours, we would have 2000 organisms.
Write a program that takes these inputs and displays a prediction of the total population.
MY PROGRAM:
organisms=int(input("Enter the initial number of organisms:"))
growth=float(input("Enter the rate of growth [a real number > 1]:"))
numHours=int(input("Enter the number of hours to achieve the rate of growth:"))
totalHours=int(input("Enter the total hours of growth:"))
population = organisms
hours=1
while numHours < totalHours:
population *= growth
hours += numHours
if hours >= totalHours:
break
print(" The total population is ", population)
My program gives the correct answer for the original problems numbers, but when I run it through our test case checker it comes back as 3/4 correct.. the problem test case being [organisms 7, growth rate 7, growth period 7, total hours 7]... can't see where I'm going wrong...
Answer:
It looks like there are a few issues with your program.
First, the line hours += numHours should be hours += 1. This is because you want to increment the hours variable by 1 each time through the loop, not by the number of hours required to achieve the growth rate.
Second, you are only multiplying the population by the growth rate once per iteration of the loop, but you should be doing it every time hours is less than or equal to totalHours. You can fix this by moving the population *= growth line inside the loop's if statement, like this:
while numHours < totalHours:
if hours <= totalHours:
population *= growth
hours += 1
if hours >= totalHours:
break
Finally, you are using the variable numHours in your while loop condition, but it should be hours. You should change while numHours < totalHours: to while hours < totalHours:.
With these changes, your program should work correctly for the test case you provided. Here is the modified version of your program:
organisms=int(input("Enter the initial number of organisms:"))
growth=float(input("Enter the rate of growth [a real number > 1]:"))
numHours=int(input("Enter the number of hours to achieve the rate of growth:"))
totalHours=int(input("Enter the total hours of growth:"))
population = organisms
Hey tell me more about your service
Answer:
look below!
Explanation:
please add more context and I’ll be happy to answer!