There's an example code in Python Intermediate course that makes no sense. | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grátis
0

There's an example code in Python Intermediate course that makes no sense.

https://www.sololearn.com/en/learn/courses/JUMP_LINK__&&__python__&&__JUMP_LINK-intermediate/lesson/2863742757?p=15 It shows the len() function being successfully called on an integer. Any avenue of reporting such issues on PC? I know the phone app has Feedback section.

11th May 2024, 3:06 PM
Igor Matić
Igor Matić - avatar
7 Respostas
+ 3
Igor Matić , what is the lesson name?
11th May 2024, 3:33 PM
Lothar
Lothar - avatar
+ 3
Hi, Igor Matić ! Normally, if you pass a number as an argument to the built-in `len` function, it results in a `TypeError`. Does this not occur, or is the error caught and handled in an exception process?
11th May 2024, 5:39 PM
Per Bratthammar
Per Bratthammar - avatar
+ 3
Igor Matić Thanks for pointing the lesson name. "More on Exception Handling" isn't in my course. Apparently SL updated the course, and the "old learner" has to reset in order to access the "updated course". There is a feedback function if you click on the humburger menu. You can also send email to info@sololearn.com and report your discovery.
12th May 2024, 4:23 AM
Wong Hei Ming
Wong Hei Ming - avatar
+ 2
Please provide the lesson name. From the link you posted, it seems it is at page 15. However, I looped through all the lesson and the max page is 8. Unless SL updated the course...
11th May 2024, 3:57 PM
Wong Hei Ming
Wong Hei Ming - avatar
+ 1
Lothar Wong Hei Ming Per Bratthammar the link works on PC. The lesson is called More on Exception Handling. The exact code writes as: year_born = 93 "if" len(year_born) != 4: "raise" "ValueError" It's one of those examples where learner needs to place correct words into correct fields, which i encased into double quotes (not to be mixed with strings).
11th May 2024, 6:40 PM
Igor Matić
Igor Matić - avatar
+ 1
Hi again Igor Matić, I couldn't find the exercise; it might have been updated. However, the code you shared makes sense in a certain context. It seems designed to check if the input, presumed to be a string, has a specific length. For example, if you input your birth year as a four-digit number (e.g., 2001), it should pass; otherwise, it should raise a `ValueError`. If this behavior isn't reflected in your exercise, you might want to report this discrepancy to SoloLearn.
12th May 2024, 5:24 AM
Per Bratthammar
Per Bratthammar - avatar
+ 1
Code for a smart market controlled by voice commands.please
12th May 2024, 9:51 AM
البصراوي كشخه