What will typing the following to Python interpreter produce?
lang = list('Python') ; lang[:-4]
Explanation
String 'Python' will first be converted to a list representation ['P', 'y', 't', 'h', 'o', 'n'] and assigned to variable lang.
Syntax [:-4] means slicing a list and returning all of its contents except for last 4 elements.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes