Jump to content

hey guys im at a very beginning stage of learning python and i have an assignment and i need help in solving the question ! it is basic python!

 

Define a function that takes a string s as its argument and checks whether (returns True or False)
all the English letters in s are in lower case.
For example, for the input string “hello”, the function returns True; for the input string “?hello?”,
the function also returns True; but for input string “Hello”, the function returns False.

CPU: FX8320 @ 4.2GHZ, GPU: R9 390 PCS+Cooler: Hyper 212 Evo, MotherBoard: ASRock 970 Extreme 3 r2.0, PowerSupply: EVGA 600b 80+Bronze, Storage: seagate Barracuda 1TB SSHD & Case: Corsair Carbide 200r

Link to comment
https://linustechtips.com/topic/244098-assignment-help/
Share on other sites

Link to post
Share on other sites

 

hey guys im at a very beginning stage of learning python and i have an assignment and i need help in solving the question ! it is basic python!

 

Define a function that takes a string s as its argument and checks whether (returns True or False)
all the English letters in s are in lower case.
For example, for the input string “hello”, the function returns True; for the input string “?hello?”,
the function also returns True; but for input string “Hello”, the function returns False.

 

Have you even attempted it so far? Post your code.

 

 

You need to use the toLower() function to compare it with itself:

return true if s.tolower == s else false;

Look up the proper tolower function in Python.

Link to comment
https://linustechtips.com/topic/244098-assignment-help/#findComment-3347506
Share on other sites

Link to post
Share on other sites

Have you even attempted it so far? Post your code.

 

 

You need to use the toLower() function to compare it with itself:

return true if s.tolower == s else false;

Look up the proper tolower function in Python.

this is what iam trying to do 

 

def allLowerCase2(s):
    if s.isupper():
        print True
    else :
        print False

CPU: FX8320 @ 4.2GHZ, GPU: R9 390 PCS+Cooler: Hyper 212 Evo, MotherBoard: ASRock 970 Extreme 3 r2.0, PowerSupply: EVGA 600b 80+Bronze, Storage: seagate Barracuda 1TB SSHD & Case: Corsair Carbide 200r

Link to comment
https://linustechtips.com/topic/244098-assignment-help/#findComment-3347549
Share on other sites

Link to post
Share on other sites

 

this is what iam trying to do 

 

def allLowerCase2(s):
    if s.isupper():
        print True
    else :
        print False

 

That isnt correct.

 

You need to convert the string to lower case and compare it with the orginal string. If the resulting string from toLower() is the same as the original string, then the original string was 100% lower case.

Link to comment
https://linustechtips.com/topic/244098-assignment-help/#findComment-3347593
Share on other sites

Link to post
Share on other sites

That isnt correct.

 

You need to convert the string to lower case and compare it with the orginal string. If the resulting string from toLower() is the same as the original string, then the original string was 100% lower case.

wow i'll try and post it, if i figure it out ! 

CPU: FX8320 @ 4.2GHZ, GPU: R9 390 PCS+Cooler: Hyper 212 Evo, MotherBoard: ASRock 970 Extreme 3 r2.0, PowerSupply: EVGA 600b 80+Bronze, Storage: seagate Barracuda 1TB SSHD & Case: Corsair Carbide 200r

Link to comment
https://linustechtips.com/topic/244098-assignment-help/#findComment-3347672
Share on other sites

Link to post
Share on other sites

That isnt correct.

 

You need to convert the string to lower case and compare it with the orginal string. If the resulting string from toLower() is the same as the original string, then the original string was 100% lower case.

im actually stuck at comparing i tried to use for loop , but no luck!

CPU: FX8320 @ 4.2GHZ, GPU: R9 390 PCS+Cooler: Hyper 212 Evo, MotherBoard: ASRock 970 Extreme 3 r2.0, PowerSupply: EVGA 600b 80+Bronze, Storage: seagate Barracuda 1TB SSHD & Case: Corsair Carbide 200r

Link to comment
https://linustechtips.com/topic/244098-assignment-help/#findComment-3347826
Share on other sites

Link to post
Share on other sites

Have you even attempted it so far? Post your code.

 

 

You need to use the toLower() function to compare it with itself:

return true if s.tolower == s else false;

Look up the proper tolower function in Python.

ok forget about for loop i did it like this 

 

def allLowerCase2(s):
    lowerS = s.lowercase
    if s == lowerS:
            return True
    else :
            return False
 
s = raw_input("string:")
print allLowerCase2(s)

CPU: FX8320 @ 4.2GHZ, GPU: R9 390 PCS+Cooler: Hyper 212 Evo, MotherBoard: ASRock 970 Extreme 3 r2.0, PowerSupply: EVGA 600b 80+Bronze, Storage: seagate Barracuda 1TB SSHD & Case: Corsair Carbide 200r

Link to comment
https://linustechtips.com/topic/244098-assignment-help/#findComment-3347860
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×