Skip to content

added: solution in python to find missing number challenge#60

Open
ederalab wants to merge 4 commits into
tomorrowdevs-projects:mainfrom
ederalab:solution/find-missing-number
Open

added: solution in python to find missing number challenge#60
ederalab wants to merge 4 commits into
tomorrowdevs-projects:mainfrom
ederalab:solution/find-missing-number

Conversation

@ederalab

@ederalab ederalab commented Oct 7, 2021

Copy link
Copy Markdown
Contributor

my solution in python

-export([start/0]).

start() ->
MyList=[230, 222, 220, 224, 229, 221, 225, 223, 228, 226],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please create a function that gets the list as an input and return the result?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hint: Try creating a function like findMissingNumber that takes a list as input and returns the missing number as output. Then call it inside your main function to test it out

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other hint:

findMissingNumber(MyList) ->
  sum(lists:seq(lists:min(MyList), lists:max(MyList))).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the code after your hint, it seems to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants