CK

@ChristoferK (8)
Simple maze-solver.
posted to Share by KalleSjoholm1

@thenullified Is it learning ? I didn't see any indication this was A.I.-resembling. I only skimmed the code quickly, and couldn't see anything unusual about it's algorithm that jumps out at me to suggest that the next time it runs the algorithm, it'll do it better than the first. But like I said, it was a skim so might have missed a key block. If this is self-learning, that would be amazing.

String Concatenation Example
posted to Share by sccshecancode

Well, technically, it is a mathematical operator, as there's nothing inherently special about numbers. It is, however, a different operator to its namesake that operates over numbers. This is immediately evident by comparing their commutative properties, for which a + b = b + a holds for the numerical operator of addition, but not for the string operator of concatenation. Both have the same associative property, however, i.e. a + (b + c) = (a + b) + c in both contexts.

100 digits of pi which ones which
posted to Share by Uzalii

Disallowing 1 as a choice doesn't make sense: the first digit of π is 3; there is no zeroth digit. Therefore, your selection range should be between 1-100 inclusive.

Simple maze-solver.
posted to Share by KalleSjoholm1

@KalleSjoholm1 That wouldn't be what a learning algorithm would be doing—at least, not an effective one. It's not so much about having a program remember past routes: that's not intelligence, it's file storage. It would be trying and adapting techniques from one iteration to the next—which can be on completely different mazes—and learning which techniques help it solve a maze in the fastest time.

For example, in the first run of this script, it might try every possible turn until it gets out. In another run, it might adapt this a little so that, it still ends up trying every turn, but has a means to ensure it won't end up going down a path it's been down before. And that can be done with two different mazes. A few more iterations down the line, and it will inevitably discover what most people know as one of the most basic ways to solve any maze, which is to always follow a path that such that you never have to let go of the wall on one side, which is a guaranteed way to escape any maze you could ever find yourself in that has a way out.

Wildest programming language idea
posted to Ask by amasad

@johnstev111 Those exist. Look up any code golfing language.

Wildest programming language idea
posted to Ask by amasad

@Viper2211 Surely better to be able to be written in any written language. Otherwise, you'd end up with lots of unhappy users shouting their foreign language at the screen, and at you you down the phone, asking why it's won't do what they say.

But there are programming languages that have provisions made to be written in many different non-English languages.

Wildest programming language idea
posted to Ask by amasad

@awesome9 Well, except it's not, and our lives are literally founded on the knowledge of the ancient Greeks, from the English words of which 5% of them are Greek; then, of course, our modern day understanding of mathematics, philosophy, ethics, chemistry, anal sex, libraries, democracy, other political systems that are better than democracy, toxic masculinity, astronomy AND astrology, the first model of the universe where Earth wasn't the centre of it all, nor flat, and the olympics (and the Olympians).

Anyway, your program outputs binary, so it's actually completely fine. It's literally what computers understand the best.

Wildest programming language idea
posted to Ask by amasad

@CodingCactus That's basically what computers are. Except where they might use a 1 (not an actual digit "1", but some representation of an on state), you're signifying that with psi. So that's kind of been around since before computers.

Wildest programming language idea
posted to Ask by amasad

@Jakman Like this? So far, Mac developers are really loving it.

Square detector
posted to Share by andliu766
Enter your number:39999995948025
This number is not a square

You and your program disagree.

To determine whether a number is square or not, one thing you could look into is prime factorisation.

What I should do next?
posted to Ask by CodingRobot12

@CodingRobot12 Are you referring to the search engine ? I wouldn't necessary embark on trying to create a search engine, and wonder if this is the right term to use. A search engine is something that operates as a back-end to provide front-end search functionality as usually one component of a larger system, and is implemented using AI, NLP and heuristic technologies that you probably need a lot of free time and a team of people if you were to make this a reality.

But if you broaden the scope a bit to experimenting more with search algorithms in the general sense, then you can tax yourself as little or as much as you like, depending on how much of the program would make use of Python's already built-in or importable functions that you can choose to call without doing any of the implementing of the actual search algorithm yourself; or you can go as far as writing the entire algorithm (of which, there are many different kinds to choose from) from scratch.

For example, you could devise a method to create a type of associative array to store key-value pairs that your user would then expect to be able to retrieve a value using a given key, or all the keys that hold a particular value.

Of course, Python already has a data structure that does this, called a dictionary, where one can do this:

trans = { "π" : 3.14159265359, "e" : 2.718281828459045, "φ" : 1.61803398874989484, ... }
print(trans["e"])

to get the value stored with the key "e". But re-inventing the wheel isn't as silly as people make it out to be, because you always learn a huge amount by figuring out how these things might (or might not) get implemented under the hood. And since not all languages have dictionaries or associative arrays, when you find yourself writing code in another language, you'll be able to do yourself what isn't readily available in many instances.

What I should do next?
posted to Ask by CodingRobot12

@CodingRobot12 Omg, I wanted you to do the search engine. Obviously that's why I was asking those questions. The rest are boring, pointless, and the same as what everyone else is doing on this site.

Do a Morse code translator, which takes an input that should be validated to be in the character set [A-Za-z0-9] and returns the same phrase expressed as Morse code.

Or, take input from the user that can contain any printable unicode character, and returns back the same characters sorted in order.

Square detector
posted to Share by andliu766

@andliu766 Really ? What's 6324555² ?

What I should do next?
posted to Ask by CodingRobot12

@CodingRobot12 Are you going to answer those questions ? Then I can give you a number.

andersons
posted to Share by PhillipAnderson

You literally just needed to type PRINT "hey" instead of just hey, and your program would have worked.

What I should do next?
posted to Ask by CodingRobot12

@CodingRobot12 That's why I asked those questions at the end. They factor heavily into the decision I would supply you with. So, if you were to implement a search engine, What would your program search for, and through what data collection, and what sort of searching algorithm would you implement ?

Square detector
posted to Share by andliu766

Is this the best way to determine whether a number is square ? If I enter the value 39999995948025, it would have to check every single integer between 1 and 6324555, and still doesn't get the answer right.

What I should do next?
posted to Ask by CodingRobot12

Out of this list, "search engine" is by far the odd one out. The others are straight forward programs that operate on a single set of rules that virtually all programmers who were told to write these would do it in more or less the same way. A search engine, however, is a very complex and ambitious option.

What would your program search for, and through what data collection, and what sort of searching algorithm would you implement ?

Math Program
posted to Share by maxxtandon
  1. Dividing polynomials:

    • "Enter in the k value", without telling you what k represents...?!
    • "For every time the power is not there in the consecutive decrease, enter 0" What does this mean ? Well, upon deciding to not enter 0, and press return, there's' a parsing error related to the line number=input(">>> ")
  2. Solve Sinusoidal Equations:

    • For values a=3, b=2, c=8, d=0 and typing "degrees" as the option, there's a math domain error related to this line: answer=(asin(d)*(pi/180))
  3. Unit Vectors:

    • "Enter in the x and y coordinates in form (x, y)" for which I supplied the input "4, 8" and got returned "(4/Input must be an integer, 8/Input must be an integer)" Both 4 and 8 are integers.
  4. The remaining vector options do work, but you use very ambiguous, undefined terminology, which makes using these functions very difficult. But once one has answered each question with the wrong values that were thought to be something else, it's evident which value represents what in your program, and then the result is correct.

Generally, I think this format of interacting with a question-and-answer based method is too 1990s, and leads to a terrible user experience. You'd be much better off having allowing free input, e.g. 5sin(4x) = 0.5 and your program parsing the input, and being able to determine which type of equation it is, and then return the solution.

Simple Calculator
posted to Share by AlBooks1

My input was as follows:

Enter choice(1/2/3/4): 1
Enter the first number: -7
Enter the second number: 3.14

The output returned was:

Traceback (most recent call last):
  File "main.py", line 8, in <module>
    num2 = int(input("Enter the second number: "))
ValueError: invalid literal for int() with base 10: '3.14'

I think you need a different data type.

100 digits of pi which ones which
posted to Share by Uzalii

@CodeABC123 Thousands ? Pah! I can write an algorithm that will generate a couple of trillion digits in under 100 iterations. But if you just want to know the value of any particular digit, it's possible to do that such that it takes no additional computer memory or time to obtain the 10-trillionth digit as it does to obtain the 2nd digit.