If this isn't the place to post questions, let me know, but I am tired, and I cannot see what to change or add

so, in my 50*ish) lines of code for a assignment in my CS104 Course, I am having issues getting specific things to print correctly, there are several things that will not print the way I want.
I would rather add code than change things that are already down, since everything else pretty much works.

Basically the code lets users input numbers between 0-1000 and through while loops and if and else statements
the end result is supposed to print a bit of info, such as:
Smallest Value (Entered)
Largest Value (Entered)
Total of Odd Integers
Total of Even Integers
Maximum Number (Entered)
Minimum Number (Entered)
Cumulative Total (Of All Numbers Entered)

and it only prints the Maximum Number correctly(so far) and the Cumulative. everything else is wrong and I have no clue what to do…
I did email my Prof, but I figured I would ask a wide community for Help.

Code is:

Only Works with Integers 0 to 1000. No Negatives, we don’t need Negativity Here.

from typing import Any

MaxInteger = 0
MinInteger = 0
tInt = 0
numInt = 0
minInt = 0.0
maxInt = 0.0
oddNum = 0
evenNum = 0
tNum = 0

userInt = float(input(“Enter an Integer or -1 to finish:”))

while nextInt != -1:

sum = str(sum + nextInt)

userInt += 1

maybe Something like ^ would work better below

while userInt >= 0.0:
if userInt >= 1000.0:
MaxInteger = MaxInteger + 1
else:
MinInteger = MinInteger + 1
if userInt < minInt:
minInt = userInt

if userInt > maxInt:
    maxInt = userInt
tInt = tInt + userInt
numInt = numInt + 1
while userInt % 2:
    if userInt > 0:
        userInt = oddNum
    else:
        userInt = evenNum

userInt = float(input("Enter an Integer or -1 to finish:"))

if numInt > 0:
average = tInt / numInt
print(“The Smallest Value is:”, MaxInteger)
print(“The Largest Value is:”, MinInteger)
# Both used to have %.2f but RUN would print that in final list.
print(“The Total of Odd Integers is:”, oddNum)
print(“The Total of Even Integers is:”, evenNum)
print(“The Maximum Number is %.2f” % maxInt)
print(“The Minimum Number is %.2f” % minInt)
print(“The Cumulative Total is %.2f” % average)

Ignore some of the # notes, those were for me, incase I needed to add something back, or change something later, or an Idea I had for the code
haha…
Thanks for Any help, this is probably some really bad looking code.

1 Like

If you are tired, getting some sleep would be much better than asking the whole global community of Python developers help you find and fix mistakes – especially if you have the resources of a school course available.
If you do ask questions like this, please take some care to remove misleading comments, add enlightening ones, and clean up your code (don’t say “this is probably some really bad looking code” but “it’s at a state where I don’t know how to make it prettier”). You’ll find that this frequently helps in spotting mistakes.
Also, when posting code, please mark it up so it is readable: here on discuss.python.org, you can use the </> icon in the toolbar for it.

5 Likes

This forum is not suitable for these types of questions. Stack overflow is good forum for these types of questions.

2 Likes

Why do you say this? This is the Users category, described as “General discussion forum for the Python programming language. All welcome.”

3 Likes

You are right. I suggested him because I think it will helpful for him and his problem may solve quickly.

1 Like