RGB2Hex project

‘’’ https://gist.github.com/530ff16508a4d98976159325ab53ad8f’ ‘’’

Could anyone please help me run this my project code as it is not working well at all? It has many errors:
Many thanks for helping me understand where I got left behind.

Hello @ijemusne, from the code on Github, it would appear that not much of your code is indented:

#This is just an example; not using your code:
def function1():
    print("Hello")#This code is correctly indented
return "Hi"#Notice how this code isn't indented?

There are many examples where the correct indenting has not been applied.

Also at the bottom of your code, inside the last else statement, you have"

else:
  "Error..."

You need to do something with that string, otherwise it will throw an error, or at least not be acted upon.

I hope this helps!
P.S. I have moved this topic into Get Help >> Python >> General.

Hi
I’m sure if I’m just too slow but I honestly still can’t figure out what is wrong with this code especially the else blocks you pointed to.
Are you willing to kindly take me through the steps to help me pinpoint the exact problem being flagged up, as I have not been able to figure out what the issues are?

Pick a problem. Describe what is currently happening. Describe what should happen. Describe the difference. Which part of your code is responsible for that behaviour?

Sounds a bit like you’re not even starting to look at things, but instead just get stuck on “eek, it’s wrong”.
Dig in.

If you wrote lots of code and then it doesn’t run, then, maybe you should write less code, run it, check your current work, and when that’s okay, continue to write more. You can for example comment out your code and slowly re-introduce parts again and fixing problems one at a time.

I will try this and many thanks for the advice.


ionatan

    April 30

ijemusne:
can’t figure out what is wrong

Pick a problem. Describe what is currently happening. Describe what should happen. Describe the difference. Which part of your code is responsible for that behaviour?

Sounds a bit like you’re not even starting to look at things, but instead just get stuck on “eek, it’s wrong”.
Dig in.

If you wrote lots of code and then it doesn’t run, then, maybe you should write less code, run it, check your current work, and when that’s okay, continue to write more. You can for example comment out your code and slowly re-introduce parts again and fixing problems one at a time.

Hello @ijemusne, when you have a string

"String1"

nothing will happen if it just on its own. You need to do something with the string. You can either store it in a variable, or return it, but you can’t leave it lying around:

def string_stuff():
  variable1 = "string1"#That is fine
  "string1"#That is NOT fine. You have to do something with it
  return "string1"#That is fine because you are doing something with it

I hope this helps!

Thanks so much! I finally get it :smiley:

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.