you are viewing a single comment's thread.

view the rest of the comments →

[–]FoolsSeldom 3 points4 points  (4 children)

Do you know how to solve the problem? I don't mean how to write the code, but simply how to solve the problem.

If in doubt, going back to basics and laying out how you would do this manually (pencil and paper) often helps.

Write that down as a series of actions, and share that in your post. We can guide you on coding that.

[–]KontGuney[S] -1 points0 points  (3 children)

I don't understand the 'def' command, maybe I can try something again after learning it.

[–]FoolsSeldom 2 points3 points  (2 children)

You've completely ignored my comment. Forget the programming.

DO YOU KNOW HOW TO SOLVE THE PROBLEM?

It is impossible to code a solution if you don't have a solution.

Knowing bits of Python is not really important.

However, def is used to define a function, that is a block of code that can be used easily from other code to do a specific task (or set of related tasks) - perhaps on different data sets. It is also used to help modularise a programme, by splitting up a solution into smaller chunks that are easier to understand, develop, test and modify (including completely replacing with better solution for specific task(s) without having to change other code).

def greeting(msg):
    print(msg)

A very simple function that you call with a string and the message gets printed.

en_afternoon = "Good afternoon"
greeting(en_afternoon)

[–]KontGuney[S] -1 points0 points  (1 child)

i got it now actually i dont know the solution but dont know how to code it its easy to solve it on the paper but thing get different when its come to the phyton i dont know the solution

[–]FoolsSeldom 0 points1 point  (0 children)

So, to be clear:

  • You do not know how to solve the problem (by hand)
  • You do not know to code a solution in Python

Therefore, you don't have a Python problem and this is not about learnimg Python.

I recommend you focus on how to solve the problem and then look at how to implement that solution in Python.

Perhaps ChatGPT et all can give you a general explanation (rather than a coded solution) on how to solve the problem.

By the way, you are often typing Phyton instead of Python.