Write the output of the given code #!/usr/bin/python
str = "this-is-real-string-example….wow!!!"
print "Min character: " + min(str)
str = "this-is-a-string-example….wow!!!"
print "Min character: " + min(str)
Answers
Answered by
1
The output of the first statement is '!'. The output of the 2nd statement is '!'.
Explanation:
In the code snippet,
- str = "this-is-real-string-example….wow!!!"
- print "Min character: " + min(str)
This statement checks the minimum alphabetical character in the string "this-is-real-string-example….wow!!!". The character '!' has ASCII value as 33, which is the smallest one in the string, hence the return value will be '!'.
- str = "this-is-a-string-example….wow!!!"
- print "Min character: " + min(str)
This statement checks the minimum alphabetical character in the string "this-is-a-string-example….wow!!!". The character '!' has ASCII value as 33, which is the smallest one in the string, hence the return value will be '!'.
Similar questions
Math,
4 months ago
English,
4 months ago
Computer Science,
4 months ago
Computer Science,
8 months ago
Computer Science,
8 months ago
Chemistry,
10 months ago
Math,
10 months ago