Computer Science
Name the function/method required to
(i) check if a string contains only uppercase letters.
(ii) gives the total length of the list.
Python String Manipulation
3 Likes
Answer
(i) isupper() method is used to check if a string contains only uppercase letters.
(ii) len() gives the total length of the list.
Answered By
2 Likes
Related Questions
Write the output of the code given below :
my_dict = {"name" : "Aman", "age" : 26} my_dict['age'] = 27 my_dict['address'] = "Delhi" print(my_dict.items())
Write a method in python to display the elements of list thrice if it is a number and display the element terminated with '#' if it is not number.
For example, if the content of list is as follows :
List = ['41', 'DROND', 'GIRIRAJ', '13', 'ZARA']
The output should be
414141
DROND#
GIRIRAJ#
131313
ZAR#What will be the output of the following code snippet ?
my_dict = {} my_dict[(1,2,4)] = 8 my_dict[(4,2,1)] = 10 my_dict[(1,2)] = 12 sum = 0 for k in my_dict: sum += my_dict[k] print(sum) print(my_dict)
Write a program that prompts for a phone number of 10 digits and two dashes, with dashes after the area code and the next three numbers. For example, 017-555-1212 is a legal input. Display if the phone number entered is valid format or not and display if the phone number is valid or not (i.e., contains just the digits and dash at specific places.)