
Заглавные буквы На вход программе подается строка состоящая из имени и фамилии человека,
разделенных одним пробелом. Напишите программу, которая проверяет, что имя и фамилия начинаются с заглавной буквы. Формат входных данных На вход программе подается строка. Формат выходных данных Программа должна вывести «YES» если имя и фамилия начинаются с заглавной буквы и «NO» в противном случае. Примечание. Строка содержит только буквы. Питон 

Ответы на вопрос

name = input("Введите имя и фамилию: ").split()
if name[0][0].isupper() and name[1][0].isupper():
print("YES")
else:
print("NO")




Problem Statement
You need to write a program in Python that checks whether both the first name and last name in a given string start with a capital letter. The program should output "YES" if both names start with a capital letter, and "NO" otherwise.
Input Format
The program takes a string as input. The string consists of a first name and a last name separated by a single space. The string contains only letters.
Output Format
The program should output "YES" if both the first name and last name start with a capital letter. If either the first name or last name does not start with a capital letter, the program should output "NO".
Solution
To solve this problem, you can use the `isupper()` method in Python to check if a character is uppercase. You can apply this method to the first character of both the first name and last name in the given string. If both characters are uppercase, the program should output "YES"; otherwise, it should output "NO".
Here is the Python code that implements this solution:
```python name = input() first_name, last_name = name.split()
if first_name[0].isupper() and last_name[0].isupper(): print("YES") else: print("NO") ```
This code first takes the input string and splits it into the first name and last name using the `split()` method. It then checks if the first character of both the first name and last name is uppercase using the `isupper()` method. If both characters are uppercase, it prints "YES"; otherwise, it prints "NO".
Example
Input: ``` John Doe ```
Output: ``` YES ```
Input: ``` jane Smith ```
Output: ``` NO ```
Input: ``` Alice Johnson ```
Output: ``` YES ```
Please let me know if you need any further assistance.


Похожие вопросы
Топ вопросов за вчера в категории Информатика
Последние заданные вопросы в категории Информатика
-
Математика
-
Литература
-
Алгебра
-
Русский язык
-
Геометрия
-
Английский язык
-
Химия
-
Физика
-
Биология
-
Другие предметы
-
История
-
Обществознание
-
Окружающий мир
-
География
-
Українська мова
-
Информатика
-
Українська література
-
Қазақ тiлi
-
Экономика
-
Музыка
-
Право
-
Беларуская мова
-
Французский язык
-
Немецкий язык
-
МХК
-
ОБЖ
-
Психология
-
Физкультура и спорт
-
Астрономия
-
Кыргыз тили
-
Оʻzbek tili