国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 衢州市| 青海省| 贵港市| 英吉沙县| 淮南市| 兴和县| 内丘县| 辉县市| 马公市| 荥经县| 丰县| 团风县| 葵青区| 柞水县| 玛曲县| 沐川县| 万年县| 土默特右旗| 焉耆| 宜阳县| 从化市| 秦皇岛市| 赤城县| 年辖:市辖区| 启东市| 靖江市| 广汉市| 大冶市| 浦县| 台北市| 大姚县| 进贤县| 招远市| 漠河县| 河北区| 常德市| 来凤县| 昂仁县| 尉犁县| 黎城县| 临沭县|