Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+5 votes
asked in CSC201 Spring 2021 by (8 points)

6 Answers

+3 votes

Variables are assigned by yourself so I dont know what you mean by the question?

answered by (8 points)
+3 votes

It's the same form like you used to calculate the number of positive numbers. It's just confusing because it's negatives.

answered by (4.4k points)

Yeah could you please tell me how we can do it ? i dont know how to do it the postive ones haha


So mine is in this form:
negative sum='''
negativeCount = '''
negative sum= '''
negativecount=negative count+1

print(negative sum)


thank you!

+3 votes

I think that we will learn about the count() function later in the course.

However, another solution to your question.
You can create another variable that can display the sum of times the negative (or positive) number appears. It also needs an if/elif function to work. If the number is positive, the variable that you have created will add 1 to itself.

For example:

positiveCount = 0
if ... :
    positiveCount = positiveCount + 1
answered by (8 points)

Thank you!

+2 votes

yeah like i already put the for loop and the if statement, i just need to print how many numbers are there and plus it in the print statement

answered by (8 points)
+2 votes

Clarify the question please! Like you can assign any variables you like, but it would be better if you use variables like positiveCount, NegativeSum as per the question!

answered by (8 points)
+1 vote

I am talking about the 1st problem of the Routine Practice 6

answered by (8 points)

FYI - Instead of writing this as an "answer" on the Q&A here it would be better to EDIT your original question, or tack a "comment" onto your question...