Jump to content

Python pgrm help

Nipplemilk909

# Program will read a sequence of positive integer's and print the number of odd inputs

#Greetings 
print("Hello.. program will commence")
for COUNTER in range(0,10):
    print(".......................................................................")
    print("///////////////////////////////////////////////////////////////////////")
    
#User input    
user_input = (input("Enter a sequence of positive integers odd and even and end your sequece with blank input")
odd_count = 0 
#Computation
while (user_input != ""):
    if (int(user_input) % 2 == 1):
        odd_count = odd_count + 1

    user_input = input("Enter Numeric Values to add up and end your submition with a Blank input   ")

print(odd_count)

giving me syntax error with odd_count = 0 

 

Link to comment
Share on other sites

Link to post
Share on other sites

You're missing parenthesis on line 10 (or an unnecessary one before input). You should use an IDE that can check that kind of stuff for you.

i9-11900K @ 5.1ghz;   RTX 3090 FE @ 2ghz;   ROG Maximus XII Hero;   4266mhz G.Skill 16GB DDR4;

Link to comment
Share on other sites

Link to post
Share on other sites

4 hours ago, auraofjason said:

You're missing parenthesis on line 10 (or an unnecessary one before input). You should use an IDE that can check that kind of stuff for you.

No you should learn to do it yourself and not rely on tools to do your job for you.

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, vorticalbox said:

No you should learn to do it yourself and not rely on tools to do your job for you.

Agreed. I am used to Eclipse for Java. When I had a course at Uni. using Pytnon, and I couldnt get PyCharm to work, I had to rely on gedit as my editor. After that semester I never get syntax-errors when programming in Java because of the pain I felt while using a plain text-editor that doesnt give you shit when you forget a parenthesis.

All "beginners" should turn off all auto-fills and those nasty red curly lines under your faulty syntax.

Running Arch with i3-gaps on a Thinkpad X1 Extreme
Data Science Postgrad

 

Link to comment
Share on other sites

Link to post
Share on other sites

7 hours ago, Nipplemilk909 said:


# Program will read a sequence of positive integer's and print the number of odd inputs

#Greetings 
print("Hello.. program will commence")
for COUNTER in range(0,10):
    print(".......................................................................")
    print("///////////////////////////////////////////////////////////////////////")
    
#User input    
user_input = (input("Enter a sequence of positive integers odd and even and end your sequece with blank input")
odd_count = 0 
#Computation
while (user_input != ""):
    if (int(user_input) % 2 == 1):
        odd_count = odd_count + 1

    user_input = input("Enter Numeric Values to add up and end your submition with a Blank input   ")

print(odd_count)

giving me syntax error with odd_count = 0 

 

Well it is telling you there is a problem with your syntax. So this means you have wrong use of white space, missing brackets or some other closing tag in your case you're missing a ")" at the end of the input line.

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×