简单计算器

目录

1. 写一个简单(+-*/)的计算器, 确保输入的都是数字(如果不是数字,让它重新输入)   输入格式必须是: 7+8 => 输出格式是 7 + 8 = 15

​编辑2. while单层循环完成9 * 9乘法表

​编辑3. str字符串中的strip, replace, split, partition, expandtabs, join,center, ljust, rjust

4. 格式化输出:    姓名       年龄        性别        家庭住址    xxx       xxxx    list_data = [{name: xxx, age: xxx, gender: xxx, address}, .....]    包含居中对齐,向左对齐, 向右对齐


1. 写一个简单(+-*/)的计算器, 确保输入的都是数字(如果不是数字,让它重新输入)
   输入格式必须是: 7+8 => 输出格式是 7 + 8 = 


2. while单层循环完成9 * 9乘法表


3. str字符串中的strip, replace, split, partition, expandtabs, join,center, ljust, rjust

  • strip

strip(self, chars=None, /)
    Return a copy of the string with leading and trailing whitespace removed.
       If chars is given and not None, remove characters in chars instead.

返回一个删除前导和尾随空格的字符串副本。
如果已给出字符而非无,则删除字符中的字符。

 

  • replace

replace(self, old, new, count=-1, /)
       Return a copy with all occurrences of substring old replaced by new.

返回一个包含所有出现的子字符串旧替换为新的副本。     
 

 

  • split

split(self, /, sep=None, maxsplit=-1)
       Return a list of the words in the string, using sep as the delimiter string.
       
    sep
        The delimiter according which to split the string.
         None (the default value) means split according to any whitespace,
         and discard empty strings from the result.
       maxsplit
         Maximum number of splits to do.
         -1 (the default value) means no limit.

拆分(Self,/,Sep=None,maxsplit=-1)
返回字符串中单词的列表,使用SEP作为分隔符字符串。
|||
C
要拆分字符串的分隔符。
无(默认值)指按任何空格拆分,
从结果中丢弃空字符串。
最大劈裂
最大数目的分裂要做。
1(默认值)表示无限制。

 

  • partition

partition(self, sep, /)
       Partition the string into three parts using the given separator.

使用给定的分隔符将字符串划分为三个部分。

 

  • expandtabs

expandtabs(self, /, tabsize=8)
 Return a copy where all tab characters are expanded using spaces.

返回一个所有制表符都使用空格展开的副本。

 

  • join(self, iterable, /)

连接任意数量的字符串。被调用方法的字符串被插入到每个给定字符串之间。结果将作为一个新字符串返回。

 

  • center(self, width, fillchar=' ', /)

返回一个长度宽度为中心的字符串。    
填充使用指定的填充字符(默认为空格)。

 

  • ljust(self, width, fillchar=' ', /)
  • rjust(self, width, fillchar=' ', /)

 

4. 格式化输出:
    姓名       年龄        性别        家庭住址
    xxx       xxxx
    list_data = [{name: xxx, age: xxx, gender: xxx, address}, .....]
    包含居中对齐,向左对齐, 向右对齐

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值