国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

python獲取從命令行輸入數字的方法

2019-11-25 17:36:48
字體:
來源:轉載
供稿:網友

本文實例講述了python獲取從命令行輸入數字的方法。分享給大家供大家參考。具體如下:

#----------------------------------------#      Name: numerical_input.py#     Author: Kevin Harris# Last Modified: 02/13/04#  Description: This Python script demonstrates #         how to get numerical input#         from the command line #         and use the if-else conditional.#----------------------------------------print()print( "Welcome to the Area calculation program" )print( "---------------------------------------" )print()# Print out the menu:print( "Please select a shape:" )print( "1 Rectangle" )print( "2 Circle" )print()# The input function both prompts the user# for input and fetches it...shape = int( input( "> " ) )# Calculate the area...if shape == 1:  height = int( input("Please enter the height: ") )  width = int( input("Please enter the width: ") )  area = height*width  print( "The area is", area )else:  radius = int( input("Please enter the radius: ") )  area = 3.14*(radius**2)  print( "The area is", area )input( '/n/nPress Enter to exit...' )

希望本文所述對大家的Python程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 常熟市| 苏尼特右旗| 新巴尔虎右旗| 霍城县| 西乌| 通辽市| 桓台县| 什邡市| 仲巴县| 南充市| 隆化县| 滦平县| 望谟县| 楚雄市| 三江| 循化| 利辛县| 双鸭山市| 那坡县| 孟津县| 克山县| 商都县| 龙山县| 石门县| 漠河县| 高安市| 塔城市| 富宁县| 青浦区| 普陀区| 武城县| 临武县| 吴江市| 长阳| 长沙市| 东乌珠穆沁旗| 宽城| 慈溪市| 奉新县| 金门县| 通许县|