Sum of odd numbers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Sum of odd numbers

My code takes integers as input, I still get an Eof:error. Please assist me. import numpy as np minimum=int(input()) maximum=int(input()) dstep=int(input()); x=np.arange(minimum,maximum,dstep) print(x[(x%2==1)].sum())

8th Jul 2022, 2:40 PM
Israel Mutebi
8 Answers
+ 1
Israel Mutebi Working fine. Can you give inputs on which code is not working?
8th Jul 2022, 2:46 PM
A͢J
A͢J - avatar
+ 3
Per Bratthammar Thx for the response. My input is like (a,b,c) format
8th Jul 2022, 2:56 PM
Israel Mutebi
+ 3
Israel Mutebi Sololearn supports inputs with separate lines. If you want to take input like a,b,c Then you have to one input and then you have to split that to get 3 separate value s = input() arr = s.split(',') a = arr[0] b = arr[1] c = arr[2]
8th Jul 2022, 3:06 PM
A͢J
A͢J - avatar
+ 2
You can link your code like this: Go to Code section, click +, select the programming language, insert your code and save. Come back to this thread, click +, Insert Code, sort for My Code Bits, select your code. If it is a sololearn task, please mention course name and task number. Please tag "Python"
8th Jul 2022, 2:42 PM
Lisa
Lisa - avatar
+ 2
Hi Israel Mutebi If you test your code in SoloLearns Playground, when you input your values, do yo input them in a line like this: 1 30 3 or like this: 1 30 3 ?
8th Jul 2022, 2:53 PM
Per Bratthammar
Per Bratthammar - avatar
+ 1
Israel Mutebi You have to take all inputs with separate lines like 1 10 1 Then enter
8th Jul 2022, 2:56 PM
A͢J
A͢J - avatar
+ 1
So Israel Mutebi Now try the other way. In the input box, put every value on a new line before you push Submit, like: 1 30 3
8th Jul 2022, 2:59 PM
Per Bratthammar
Per Bratthammar - avatar
0
A͢J Line4: Eof:error when reading a line. I don't know yet how to get that right
8th Jul 2022, 2:52 PM
Israel Mutebi