Helpppp me plz | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Helpppp me plz

I need help with making the program I'm making choose a random else statement https://code.sololearn.com/cP7jsJ2pbq46/?ref=app

19th Apr 2017, 11:21 AM
Anonymous
Anonymous - avatar
10 Answers
+ 10
javascript will probably be harder... python is one of the easier languages.
19th Apr 2017, 12:18 PM
J.G.
J.G. - avatar
+ 10
So you have an if statement. If it is not evaluated to true, then yo want it to execute some random thing? I am a little confused as to what you want...
19th Apr 2017, 11:39 AM
J.G.
J.G. - avatar
+ 10
So you want one of those to be chosen. Well, I would have only one else statement that combines all of your possible outputs. You can generate a random integer and use that in a switch and have the possibilities for the integer be the cases of the switch. I hope this makes sense.
19th Apr 2017, 11:43 AM
J.G.
J.G. - avatar
+ 9
Just generate a random int between [1 and 2 in your case] and have a switch with case 1 being one of the else statements and case 2 being the other else statement. Or you could generate random between 0 and 1 and use another if statement (true or false) Does this make sense?
19th Apr 2017, 12:13 PM
J.G.
J.G. - avatar
+ 9
Hmm... Okay. Whatever you want. I would suggest going through the tutorials more to learn the languages better. They explain all of this; switch caes, randInt generation, if/else and nesting... They are there for a reason. But whatever you want to do. :)
19th Apr 2017, 12:22 PM
J.G.
J.G. - avatar
+ 1
I want to make it choos a random else I put two else's but I need the program to chose a random else thing https://code.sololearn.com/cP7jsJ2pbq46/?ref=app
19th Apr 2017, 11:40 AM
Anonymous
Anonymous - avatar
+ 1
but how
19th Apr 2017, 11:48 AM
Anonymous
Anonymous - avatar
19th Apr 2017, 11:48 AM
Anonymous
Anonymous - avatar
+ 1
I'm done learning python f*** this s*** plz don't ban me imma go learn some fu***** JavaScript
19th Apr 2017, 12:14 PM
Anonymous
Anonymous - avatar
+ 1
fu**************** ima go learn swift
19th Apr 2017, 12:19 PM
Anonymous
Anonymous - avatar