#raindrop python help
19 messages · Page 1 of 1 (latest)
- Do you understand what the test is doing?
- Do you understand what the test is expecting and why?
- Do you understand what your code returns and how it differs?
- Do you understand why your code is returning what it returns?
You might also want to share your code. Please use codeblocks and not screenshots.
We have no way to help you unless you show your code
this is the code
def convert(number):
all=""
if number%3==0:
all="Pling"
elif number%5==0:
all+="Plang"
elif number%7==0:
all+="Plong"
else:
all=str(number)
return all
- Do you understand what the test is doing?
- Do you understand what the test is expecting and why?
- Do you understand what your code returns and how it differs?
- Do you understand why your code is returning what it returns?
@hoary pecan Increase your chance of getting help and look like a pro by sharing codeblocks not images. For example, you can type the following. Note, the ``` must be on their own line.
```
for number in range(10):
total += number;
```
Discord will render that as so:
for number in range(10):
total += number;
Click here to learn more about codeblocks: https://exercism.org/docs/community/being-a-good-community-member/writing-support-requests
def convert(number):
all=""
if number%3==0:
all="Pling"
elif number%5==0:
all+="Plang"
elif number%7==0:
all+="Plong"
else:
all=str(number)
return all
What about my questions? 🙂
- yes I understand what the test is doing
2.yes I do
3.yes
4.yes
If you understand why your code is returning what it is returning and why it is wrong, do you know how to fix it?
@hoary pecan ?
my code is returning the all variable , which has PlingPlangPlong according to the number which has factors of 3,5,7 respectively
Which lines execute in what order when it is called with 15?
I got it now
it was because I was using elif
I used if and code got solved! thanks
all=""
if number%3==0:
all="Pling"
if number%5==0:
all+="Plang"
if number%7==0:
all+="Plong"
if number%3!=0 and number%5!=0 and number%7!=0:
all=str(number)
return all
Nicely solved!!