python map convert string to uppercase code example

Example 1: how to convert list to all uppercase

#Capitalise list

c = ['Kenya','Uganda', 'Tanzania','Ethopia','Azerbaijan']

converted_list = [x.upper() for x in c]print(converted_list)print("Remember to clap :-)")

Example 2: Write a method that converts all strings in a list to their upper case lambda

import java.util.Arrays;
import java.util.List;
//www .  jav a 2 s  .  c o  m
public class Main {

  public static void main(final String[] args) {
    List<String> friends = Arrays.asList("Ross", "Chandler", "CSS",
        "Monica", "Joey", "Rachel");

    friends.stream().map(name -> name.toUpperCase())
        .forEach(name -> System.out.print(name + " "));

  }

}