79536936

Date: 2025-03-26 18:20:42
Score: 0.5
Natty:
Report link

Thank you very much for your feedback and help. I now know that this website is not for beginner Programmers. My brain is struggling to wrap around the coding concept. Thankfully, I have found some beginner Python forums and I will direct my questions there. Secondly, yes I agree that Zybooks is awful. We are literally unable to delete or change existing code as the program will not allow you too. It can be frustrating when asking for help or using tutoring as they often point out the errors.

Lastly, with your help I found the problem. Here is the corrected code with 5/5 tests passed.

string = input()
valid = True
i = 0

while valid and i < len(string) :
    # To be valid, the string can only contain digits 
    # and a sign character (+ or -) as the first character.
    if i == 0: 
        if not (string[i].isdigit() or string[i] in ['+','-']) : 
            valid = False
    else :
        if not string[i].isdigit() : 
            valid = False
    i += 1

if valid :
    print("valid integer")
else :
    print("invalid integer")
Reasons:
  • Blacklisted phrase (0.5): Thank you
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: PS Ormenda