当前位置: 首页 > news >正文

制作网页网站小说教程南昌网站建设规划方案

制作网页网站小说教程,南昌网站建设规划方案,建立网站如何规划和实施建设,阿里巴巴怎么做公司网站分类:字符串 知识点: 获取输入 input().strip().split(" ") 拼接列表 " ".join(list) 输出指定位数的浮点数 print("%.2f" % value) len() 函数对于很多内置的数据类型都适用,它返回对象的元素个数或长度。…

分类:字符串

知识点:

  1. 获取输入 input().strip().split(" ")

  2. 拼接列表 " ".join(list)

  3. 输出指定位数的浮点数 print("%.2f" % value)

  4. len() 函数对于很多内置的数据类型都适用,它返回对象的元素个数或长度。

# 用法1: 获取字符串的长度
string_example = "Hello, World!"
length_of_string = len(string_example)
print("字符串的长度为:", length_of_string)# 用法2: 获取列表或元组的元素个数
list_example = [1, 2, 3, 4, 5]
length_of_list = len(list_example)
print("列表的元素个数为:", length_of_list)# 用法3: 获取字典的键值对个数
dictionary_example = {"a": 1, "b": 2, "c": 3}
length_of_dictionary = len(dictionary_example)
print("字典的键值对个数为:", length_of_dictionary)# 用法4: 获取集合的元素个数
set_example = {1, 2, 3, 4, 5}
length_of_set = len(set_example)
print("集合的元素个数为:", length_of_set)# 用法5: 获取其他可迭代对象的元素个数
tuple_example = (1, 2, 3, 4, 5)
length_of_tuple = len(tuple_example)
print("元组的元素个数为:", length_of_tuple)

题目来自【华为招聘模拟考试】

图片

# If you need to import additional packages or classes, please import here.def func():# please define the python3 input here. For example: a,b = map(int, input().strip().split())words = input().strip().split(" ")# please finish the function body here.total_words = len(words)new_str = "".join(words)total_length = len(new_str)# please define the python3 output here. For example: print().# print(round(total_length/total_words, 2)) # round有bugprint("%.2f" % (total_length/total_words))if __name__ == "__main__":func()

注意,不要使用round,有bug

by: 软件工程小施同学

http://www.yayakq.cn/news/311607/

相关文章:

  • 个人发布房源的网站seo网站推广费用
  • 惠州做网站乐云seo哪个网站用div做的好
  • 网站内容智能暴雪倒闭
  • 团建拓展网站建设需求分析wordpress全站关闭评论
  • 卖主机 服务器的网站湖南app开发
  • 淘宝客网站源码html品牌宣传型网站构成
  • 里水九江网站建设php网站开发实践指南
  • 做快消品的网站网站的建设方法不包括什么问题
  • 陕西做网站的公司电话河北招标网
  • 个人电脑做网站服务器wordpress 微信通知
  • 网站底部浮动代码常营网站建设
  • 怎么样做兼职网站移动网站系统
  • 专门做正品的网站手机版绿色环保网站模板
  • 长春网站建设phpjz企业宣传册模板免费下载
  • 苏州移动网站建设吉林省长春市建设局网站
  • 网站建设 前端 后端铜仁网站建设公司
  • 慈溪白云小学班级网站建设商标查询免费
  • 制作网站公司多少钱网站 图文混编
  • cdr做的网站效果怎么直接用wordpress登录不进去
  • 可以做兼职的网站有哪些郴州网警
  • 成都市 网站建设郑州工程造价信息网
  • 有了网站源码 怎么建设网站好听的广告公司名字
  • 怎么制作网站应用做网站自己装服务器
  • 企业做网站这些问题必须要注意wordpress自定义表格
  • 企业网站seo优帮云珠海做企业网站多少钱
  • php做的网站如何该样式网站建设需求表
  • 免费logo网站云南省玉溪市江川区住房和城乡建设局网站
  • 小企业网站建设收费织梦网站 伪静态
  • 基于 的企业网站建设小蜜蜂网站建设
  • 重庆专业网站推广公司旅游网站的导航怎么做