CODING CHALLENGES #1 !! Calculator with one input | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 19

CODING CHALLENGES #1 !! Calculator with one input

Thank you @Agus Mei for this great idea! What if we do coding challenges like @Agus is making his/her quizzes? Allright! My first challenge is: A calculator that takes needs one input like 2 * 2... Then the computer should assign the first number to a variable, second one to the operator and third one as a number... NO GOOGLE OR STACKOVERFLOW!! I've done mine in Python!! https://code.sololearn.com/cZnJoi6o1q5Z/?ref=app

11th Apr 2017, 8:48 AM
Gami
Gami - avatar
28 Antworten
11th Apr 2017, 10:06 AM
Heng Jun Xi
Heng Jun Xi - avatar
+ 22
give me 10 min (5 to launch pc)
11th Apr 2017, 11:49 AM
Illusive Man
Illusive Man - avatar
+ 21
Sorry for such a delay, had to make "emergency computer cleaning" (dust on coolers u know) https://code.sololearn.com/cdNr9glA9qeI/?ref=app Made completely from scratch with basic stuff
11th Apr 2017, 6:31 PM
Illusive Man
Illusive Man - avatar
+ 20
@Leandro try to do it yourself. If there'll be errors post question and people will help u. If somebody else does that for you it gives you nothing in term of experience.
11th Apr 2017, 10:58 PM
Illusive Man
Illusive Man - avatar
+ 19
@Leandro tasks 1-4, 6-7, 9 "for" loop task 5 "for" loop + array tasks 8, 10 if + "for" loop
11th Apr 2017, 6:52 PM
Illusive Man
Illusive Man - avatar
+ 12
I have quite the something here, it would just require tweaking to get user input into appropriate arrays. Will submit if time permits. https://code.sololearn.com/ceu6YdjX2LPc/?ref=app
11th Apr 2017, 9:02 AM
Hatsy Rei
Hatsy Rei - avatar
+ 12
@MrCoder This is what I am planning to do... The next one is coming soon :)
12th Apr 2017, 9:37 AM
Gami
Gami - avatar
+ 12
#uh guys... eval(input()) #you literally only need one line to do this in python
12th Apr 2017, 10:59 AM
Ahri Fox
Ahri Fox - avatar
+ 10
You need to insert it here after you finish!
11th Apr 2017, 8:50 AM
Gami
Gami - avatar
+ 10
@Sahaj Yes, you can put more operators. You will have to think what if the user inputs something like 9*7, without spaces in between
11th Apr 2017, 9:08 AM
Gami
Gami - avatar
+ 10
@Hatsy But you will have to start from scratch
11th Apr 2017, 9:09 AM
Gami
Gami - avatar
+ 10
@Mr Coder... It has to be error-free. Operations without whitespaces won't work... @Wen Qin It had to be done from scratch @Heng Congratulations mate, you won!!
11th Apr 2017, 12:08 PM
Gami
Gami - avatar
+ 10
@Wen The challenge is over, as you can see we already have a winner... I am not going to post the solution until we get the best answer.
12th Apr 2017, 8:05 AM
Gami
Gami - avatar
+ 9
Mine was already done loooooooong time ago https://code.sololearn.com/cDfv9X32nXE6/?ref=app
11th Apr 2017, 10:25 AM
Wen Qin
Wen Qin - avatar
+ 7
Yo @Gami Check mine out B), Any rewards? Challenge Complete https://code.sololearn.com/cDmKOZKcLO2V/?ref=app
11th Apr 2017, 9:55 AM
MrCoder
MrCoder - avatar
+ 6
https://code.sololearn.com/c8Z5xAE9yRk4/?ref=app Done, I had to redo RegEx course for this 😂
12th Apr 2017, 9:18 PM
Supersebi3
Supersebi3 - avatar
+ 5
@gami whats the point of starting it from scratch if you already did :V I am most likely going to copy and paste from C# ro C++ and modify a bit only.
11th Apr 2017, 10:44 PM
Wen Qin
Wen Qin - avatar
+ 5
@Gami Can you do more of these? Maybe make this a series everyday it practices me well :D
12th Apr 2017, 8:08 AM
MrCoder
MrCoder - avatar
14th Apr 2017, 2:17 AM
Siddharth Saraf
+ 4
will it be just an operand operator operand format or there could be more operators as well ?
11th Apr 2017, 9:07 AM
Sahaj Bamba
Sahaj Bamba - avatar