Please is to be added or removed from this code n = int(input()) for x in range(1, n): if x % 3 == 0 and x % 5 == 0: | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please is to be added or removed from this code n = int(input()) for x in range(1, n): if x % 3 == 0 and x % 5 == 0:

Output error

4th Jan 2023, 1:04 AM
Ohanenye Kennedy
Ohanenye Kennedy - avatar
10 Answers
+ 2
Please don't write code in the post title, codes get truncated and lose their formatting such that they become hard to read and links don't work when being placed in the post title or tags. Is this the fizz-buzz thing?
4th Jan 2023, 1:27 AM
Ipang
+ 2
Sorry bro, not gonna go there. I can write you that code, but it means I'm ruining your learning experience. Tell me what's troubling you, so I can provide you hints ...
4th Jan 2023, 1:48 AM
Ipang
+ 2
The loop is basically correct, you only missed the range stepping argument. We can utilise the range() 3rd argument which specifies the range stepping. https://realpython.com/JUMP_LINK__&&__python__&&__JUMP_LINK-range/ By setting the range atepping to 2, we can skip even numbers ...
4th Jan 2023, 2:04 AM
Ipang
0
Yes it is the fizz - buzz thing, I don't understand what to do
4th Jan 2023, 1:33 AM
Ohanenye Kennedy
Ohanenye Kennedy - avatar
0
Which part of the task requirement wasn't clear? we are asked to loop from 1 to given <n>, and we should only care for odd numbers. ..,
4th Jan 2023, 1:38 AM
Ipang
0
Could you write me the full code pls
4th Jan 2023, 1:39 AM
Ohanenye Kennedy
Ohanenye Kennedy - avatar
0
Okay, the code seemed correct but when it's been ran, it output some numbers that makes it all wrong.
4th Jan 2023, 1:54 AM
Ohanenye Kennedy
Ohanenye Kennedy - avatar
0
Continue with the if loop, use "elif"
4th Jan 2023, 9:22 PM
Emmanuel Itoya
Emmanuel Itoya - avatar
0
For project five, where you have to make use of the readline() and the n\, I don't know why they aren't going through
15th Jan 2023, 9:27 PM
Ohanenye Kennedy
Ohanenye Kennedy - avatar
0
Read through these, pretty sure good points can be extracted from there. Search the forum with 'book title' query to find more ... https://www.sololearn.com/Discuss/2667125/?ref=app https://www.sololearn.com/Discuss/2589736/?ref=app
16th Jan 2023, 7:34 AM
Ipang