0

I am trying to do a for loop which return 0 and 1values based on a set threshold please help me? This what i understand it to be

I have this and it is not functional cause i am new and not sure where what goes! until i become an intermediate i am relying heavily on you pros to assist and guide me! So in advance thank you so much! I am gaining an understand but it is a slow process and i hope i am doing it the right way x = input(" Please enter your x number value: ") y = input(" Please enter your y number value: ") threshold = 4 for x in range(x): x <= threshold print("x = 1") if x in range(x) >= threshold: print("x = 0") for y in range(y): y <= threshold print("y = 1") if y in range(y) >= threshold: print("y = 0") i am.not sure where my errors are please guide me

9th Jun 2019, 5:01 AM
Ranking
Ranking - avatar
5 Réponses
+ 3
What would the output look like if x = 5 and y = 3?
9th Jun 2019, 5:21 AM
Anna
Anna - avatar
0
Can you provide more details on what you want to achieve? And what you have already tried? like, provide a link to your code.
9th Jun 2019, 5:23 AM
Yugabdh
Yugabdh - avatar
0
Yugabdh can you not see my code? I think i explained this the best way i could
9th Jun 2019, 5:30 AM
Ranking
Ranking - avatar
0
Hi Anna the output would either be a 1 if the input value is <= threshold and a 0 if the input value is >= to threshold binarization format
9th Jun 2019, 5:31 AM
Ranking
Ranking - avatar
0
Hi Jay Matthews, thats my problem i am not sure where to put your response when it is like this and i don't get the chance to understand it! please help me to understand where to put it and what am i doing wrong? thanx in advance JM
9th Jun 2019, 5:33 AM
Ranking
Ranking - avatar