Computer Science, asked by sagargswamigsm1995, 8 months ago

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 letmeanswer12
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