Python problem; code from codecatemy to sololearn "code playground" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Python problem; code from codecatemy to sololearn "code playground"

Hello; I try to learn python; i use 2 website Codecademy and Sololearn. why do when I put the code from Codecademy exercise into the Sololearn code playground, nothing work ? exemple : EXERCICE 1 my_string = "stringgggg" print len(my_string) print my_string.upper() * Codecademy result : [code] 10 STRINGGGGG [/code] * Sololearn result : [code] File "..\Playground\", line 2 print len(my_string) ^ SyntaxError: invalid syntax [/code] EXERCICE 2 name = raw_input("What is your name? ") quest = raw_input("What is your quest? ") color = raw_input("What is your favorite color? ") print "Ah, so your name is %s , your quest is %s , " \ "and your favorite color is %s ." % (name, quest, color) * Codecademy result : -console ask the 3 question then print the string wit the answer as "%s" - * Sololearn result : [code] File "..\Playground\", line 5 print "Ah, so your name is %s , your quest is %s , " \ ^ SyntaxError: Missing parentheses in call to 'print' [/code] What's wrong ? is the code from codecademy not "real python" code ?

5th Feb 2018, 12:14 PM
Boris BELLOC
Boris BELLOC - avatar
6 Answers
+ 4
Keep in mind, Codecademy uses Python 2.x, and SoloLearn uses Python 3.x Due to the differences in the syntax of the two, there is bound to be issues. I suggest using something other than Codecademy, such as TutorialsPoint. 👍
5th Feb 2018, 12:03 PM
Dread
Dread - avatar
+ 2
wow every thing i learnt from codecademy wont work on python 3 ? wtf i feel scammed, i wanted to learn python 3, thanks for your answer
5th Feb 2018, 12:05 PM
Boris BELLOC
Boris BELLOC - avatar
+ 2
exercice 1: print(my_string.len()) exercice 2: print("ah so your name is",name,"and your quest is",quest)
5th Feb 2018, 12:06 PM
Jojojo Jo
+ 1
SoloLearn is Python 3.x, and so is TutorialsPoint. Try those only! 👍
5th Feb 2018, 12:05 PM
Dread
Dread - avatar
+ 1
thank you very much Jojojo Jo, I wanted to know the real solution but I tought it would be too much to ask =) thanks Jonathan Carver i didn't know the website TutorialsPoint, i will try it once I finish Sololearn
5th Feb 2018, 12:16 PM
Boris BELLOC
Boris BELLOC - avatar