Difference between revisions of "Coursera Google Python Automation Course"
Jump to navigation
Jump to search
Line 23: | Line 23: | ||
</pre> | </pre> | ||
==[[#top|Back To Top]] - [[Python|Category]]== | ==[[#top|Back To Top]] - [[Python|Category]]== | ||
[[Category:Python]] |
Latest revision as of 16:21, 1 September 2020
If statements
def convert_distance(dist, unit): # if(unit =="mile"): xtext=" The distance is " ml = dist / 1.6 mlr = int(ml) output = xtext + str(mlr) + " " + unit return output elif(unit=="km"): xtext=" is " km = dist * 1.6 kmr = int(km) output = str(dist) + " Miles" + xtext + str(kmr) + " " + unit return output xme = convert_distance(100, "km") print(str(xme))