Czyrek
0
Q:

how can I convert into lowersase a total sentence in python?

# By Alan W. Smith and Petar Ivanov
s = "Kilometer"
print(s.lower())
17
# Python3 program to show the 
# working of lower() function 
text = 'GeEks FOR geeKS'
  
print("Original String:") 
print(text) 
  
# lower() function to convert  
# string to lower_case 
print("\nConverted String:") 
print(text.lower()) 
0
students = ['Sarah', 'Mary', 'Anna', 'Charlotte']

# Option 1
students_lower = map(lambda x: x.lower(), students)   # map() produces a generator
print(list(students_lower))                           # give all elements of the generator

# Option 2
students_lower = [student.lower() for student in students] # list comprehension

# Option 3
students_lower = (student.lower() for student in students) # generator comprehension
print(list(students_lower)) 
0

New to Communities?

Join the community