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

首頁 > 編程 > Python > 正文

python獲取從命令行輸入數(shù)字的方法

2020-02-23 00:57:11
字體:
供稿:網(wǎng)友

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

#----------------------------------------#      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...' )

希望本文所述對(duì)大家的Python程序設(shè)計(jì)有所幫助。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 永德县| 西吉县| 克山县| 清流县| 新竹市| 旺苍县| 略阳县| 扎鲁特旗| 华亭县| 平乡县| 吉安县| 琼海市| 利津县| 桓仁| 夏河县| 井陉县| 策勒县| 云安县| 兴国县| 崇文区| 平利县| 阜新| 讷河市| 尚义县| 安岳县| 孟连| 报价| 三门县| 望城县| 泰顺县| 黄骅市| 永清县| 四川省| 黄山市| 武安市| 开封县| 临澧县| 西安市| 凯里市| 兴文县| 界首市|