博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
利用python做一个简易计算器
阅读量:3906 次
发布时间:2019-05-23

本文共 374 字,大约阅读时间需要 1 分钟。

a,b,c=input('输入的a,b,c用空格间隔开').split()#a b 为数  c 为操作数a1=int(a)b1=int(b)if((c=='+')|(c=='-')|(c=='*')|(c=='/')):        if c =='+':          print(a1+b1)        elif c=='-':          print(a1-b1)        elif c=='*':          print(a1*b1)        else:          if b1==0:            print('Divided by zero')          else:            print(a1/b1)else:  print("Invalid operator")

转载地址:http://xxmen.baihongyu.com/

你可能感兴趣的文章
Django short url
查看>>
Tech Blog
查看>>
Logon System Design
查看>>
Python yield
查看>>
Sina API OAuth
查看>>
Python supervisor
查看>>
dict & set
查看>>
Common Multiple and Least Common Multiple(LCM)
查看>>
Greatest Common Divisor (GCD) - Euclidean algorithm
查看>>
Regular Expression Python
查看>>
大数据处理
查看>>
Mapreduce 通俗版
查看>>
MapReduce Inverted index
查看>>
MapReduce Intro
查看>>
Mapreduce Patterns, Algorithms, and use cases
查看>>
Hadoop interview
查看>>
数据处理问题
查看>>
BloomFilter
查看>>
Bloom Filter - Math deduce
查看>>
Bit Byte Megabyte Gigabyte
查看>>