+ 54
Why output is r ?
print(max("Sololearn")) https://ibb.co/C8kPByg
31 Réponses
+ 26
Check this out for reference:
https://code.sololearn.com/cGh63mKrL4iT/?ref=app
+ 26
+ 12
If you see the ASCII values of all the letters in SoloLearn then you will see that the 'r' comes the last:
You can remember ascii in this way:
65-90 -> capital letters (A,B,C,D......)
97-122 -> lowercase letters (a,b,c,d.....)
49-58 -> numbers (1,2,3,4......)
So if it was 'sololearn' then the highest value would be 's'
+ 12
Gaurav Dixit 🇮🇳 I know that, I just gave him an example that if 's' was in lowercase then the answer would have been 's' instead of 'r'
+ 11
Kuba Siekierzyński 👏👏👏👍👍👍
32 -> ' ' (space)
Try this:
chr(83) + chr(105) + chr(109) + chr(98) + chr(97)
output: Simba
In order to find out tge ascii value of any letter:
print(ord('S'))
output: 83
+ 9
Simba
it's take max of ASCII code
+ 9
Gaurav Dixit 🇮🇳 you're correct. But it's working now✌
+ 8
Namit Jain
In question S is capital bro read question carefully
+ 8
It is taking ascii value of every character. Ascii value 'S' and 'L' in SoloLearn are 83 nd 76. All other characters in small letter are having more ascii value than S nd L. Among 'oloearn' ascii value of "r" is max.
+ 8
Akshay Panwar
《R@j ☆ $!ng#》
Thank you👍
+ 6
The Ascii value of small letters is greater than that of capital letters
So the Ascii vaue of r is greater than S
Hence the max returns the value r as output
+ 5
《R@j ☆ $!ng#》 this is for you👇
https://code.sololearn.com/Wy3lrXNwGsgJ/?ref=app
+ 5
The answer is r and the reason is because the position python is in
using the max () function returns the largest element in an iterable.
But it can also be used to find the largest element between two or more parameters
and that is why in the word "SoloLearn" by searching in it using the max () function
find the character that has the assignment in ascii is "r" when comparing among others.
r has the highest value
S = 83
o = 111
l = 108
o = 111
L = 76
e = 101
a = 97
r = 114
n = 110
+ 4
Ascii for Capital letters start from 65
And for small letters it starts from 97
+ 3
I am not able to understand answer is "S" or "r"
+ 3
+ 2
Simba also your app is not working
+ 2
somya darshi patra 's' is in capital letter see carefully ('S')
+ 2
In this question ascii value of r is higher thats way the answer will be (r).🤗
+ 2
I anyone satisfied with my reason then give me up vote