CodeSolved

A comprehensive source of programming questions and exercises

The number of lower and uppercase letters

Practice Easy 362/ Download 2961 Views

Write a program that receives a string from the entrance and counts and displayed the upper and lowercase letters.

11 Answers

This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
user_input = input("please enter a string you want: ")
def count_upper_lower(s):
    upper_count = 0
    lower_count = 0
    for char in s:
        if char.isupper():
            upper_count += 1
        elif char.islower():
            lower_count += 1
    return upper_count, lower_count
upper_word, lower_word = count_upper_lower(user_input)
print(f"your upper word is: {upper_word}")
print(f"and your lower words are: {lower_word}")
Mhghasri Download Python
bozorg = 0
kochak = 0
str = input("please enter a sentence: ")
for i in str:
    if i.isupper():
        bozorg += 1
    elif i.islower():
        kochak += 1
print("horoufe bozorg =",bozorg,"/", "horoufe kochak = ", kochak)
def calculate_str(str):
    upper=0
    lower=0
    for char in str:
        if char.isupper():
            upper+=1
        elif char.islower():
            lower+=1
    return f"upper: {upper},lower: {lower}"

print(calculate_str(input("text: ")))
Saeeda33 Download Python
def count_upper_lower(s):
    upper_count = 0
    lower_count = 0
    
    for char in s:
        if char.isupper():
            upper_count += 1
        elif char.islower():
            lower_count += 1

    return upper_count, lower_count

# Receive a string from user input
input_string = input("یک رشته وارد کنید: ")

# Count uppercase and lowercase letters
upper, lower = count_upper_lower(input_string)

# Display the result
print("تعداد حروف بزرگ:", upper)
print("تعداد حروف کوچک:", lower)
Milad.bio Download Python
user_input = input("Please enter a string: ")

lowercase_count = 0
uppercase_count = 0

for char in user_input:
    if char.islower(): 
        lowercase_count += 1
    elif char.isupper(): 
        uppercase_count += 1

print(f"Lowercase letters: {lowercase_count}")
print(f"Uppercase letters: {uppercase_count}")
Maryam.n Download Python
static string MaxUpperAndLowerCase(string text){
        int countOfLowerCase = 0;
        int countOfUpperCase = 0;
        for (int i = 0; i < text.Length; i++) {
            char Character = text[i];
            if (!Char.IsLetter(Character)){
                continue;
            }
            if (Char.IsUpper(Character)){
                countOfUpperCase+=1;
            }else{
                countOfLowerCase+=1;
            }
        }
        return "count of Upper Case is : "+countOfUpperCase.ToString()+" Count Of Lower Case "+countOfLowerCase.ToString();
    }
User 2501 Download C#
def up_down(txt):
    up = 0
    low = 0
    for i in txt:
        if i.isdigit(): continue
        elif i.isupper(): up += 1
        elif i.islower(): low +=1
    return up , low
text = input('text: ')
up_down(text)
upper , lower = up_down(text)
print(f'upper : {upper}\nlower: {lower}')
<< Previous page 1 2 Next page >>

Submit answer

Submitting answers is currently unavailable.

Related content

Detection using AI
×
×
Close