CodeLab Academy 📞 9936 6696
← Lessons 🐍 Python for Beginners

Strings and lists

## Strings (str) ```python s = "python" print(len(s)) # 6 print(s[0]) # p print(s[-1]) # n print(s.upper()) # PYTHON print(s[::-1]) # nohtyp ``` ## Lists (list) ```python nums = [5, 2, 8, 1] nums.append(10) print(sum(nums), max(nums), min(nums)) print(sorted(nums)) ``` ## Reading a list from one line ```python n = int(input()) a = list(map(int, input().split())) ```
← Previous

💡 Want to track which lessons you've read and solve problems for points? Sign up for free or log in.