Why does this Python code not work | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Why does this Python code not work

If you look at the code, I think you can tell what I am trying to do. If not, let me know here and I will explain. Try inputting ā€œhiā€, then ā€œbyeā€. [EDIT]: Link removed (Iā€™m working on another project that I donā€™t want anyone to see.)

5th Jul 2018, 5:02 PM
šŸŗMichaelšŸŗ
šŸŗMichaelšŸŗ - avatar
7 Answers
+ 3
this will work, i hope you get it https://code.sololearn.com/cNx29fUIpT6H/?ref=app
5th Jul 2018, 5:12 PM
Pulkit Kamboj
Pulkit Kamboj - avatar
+ 4
Pulkit Kamboj Thank you!!!
5th Jul 2018, 5:17 PM
šŸŗMichaelšŸŗ
šŸŗMichaelšŸŗ - avatar
+ 2
Arthur ,sorry for responding so late as I had hactic classes at my University so I had no time to reply, but today I had the time so you can check my recent code dice game using class and object, but if you do not want to use classes and object, then your code is nearly perfect just you should try to use random.randint instead of random.choice do this particular case. It's happy to see you making lots of codes in recent days. I hope my code and suggestions help you.
14th Jul 2018, 4:42 AM
Pulkit Kamboj
Pulkit Kamboj - avatar
+ 1
Pulkit Kamboj You can use "upper.lower"(is something like this. i dont remenber at all) that make all the words in the variable (and have a command that puts only the first letter) lower so you dont have to put "Bye" or "bye"
6th Jul 2018, 2:00 AM
I Am Arthur
I Am Arthur - avatar
+ 1
yes Arthur it could be solved by modifying first line as s=input(). lower () but i wanted to point out the error in the code.
6th Jul 2018, 2:08 AM
Pulkit Kamboj
Pulkit Kamboj - avatar
+ 1
Pulkit Kamboj Oh haha.I tried to help and i got helped.Thx anyway
6th Jul 2018, 2:18 AM
I Am Arthur
I Am Arthur - avatar
0
Pulkit Kamboj I think u know a lot of python.Can you see my last code and tell me if it can be shorter or more organised?
6th Jul 2018, 2:20 AM
I Am Arthur
I Am Arthur - avatar