Python3-string-max

提供:Dev Guides
2020年6月22日 (月) 21:36時点におけるMaintenance script (トーク | 投稿記録)による版 (Imported from text file)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先:案内検索

Python 3-String max()メソッド

説明

  • max()*メソッドは、文字列strから最大のアルファベット文字を返します。

構文

以下は* max()*メソッドの構文です-

max(str)

パラメーター

*str* -これは、最大のアルファベット文字を返す必要がある文字列です。

戻り値

このメソッドは、文字列strから最大アルファベット文字を返します。

次の例は、max()メソッドの使用法を示しています。

#!/usr/bin/python3

str = "this is a string example....really!!!"
print ("Max character: " + max(str))

str = "this is a string example....wow!!!"
print ("Max character: " + max(str))

結果

上記のプログラムを実行すると、次の結果が生成されます-

Max character: y
Max character: x