#_author:Doraemon Liu
# -*- coding:utf-8 -*-
# name = "aleX leNb "
# 有变量name = "aleX leNb " 完成如下操作:
# - 移除 name 变量对应的值两边的空格,并输出处理结果
# name1 = name.lstrip()
# name2 = name1.rstrip()
# print(name2)
# - 判断 name 变量是否以 "al" 开头,并输出结果(用切片)
# data = name[0:2]
# if data == "al":
# print(data)
# - 判断name变量是否以"Nb"结尾,并输出结果(用切片)
# data = name[-3:-1]
# if data == "Nb":
# print(data)
# - 将 name 变量对应的值中的 所有的"l" 替换为 "p",并输出结果
# data = name.replace("l","p")
# print(data)
# - 将name变量对应的值中的第一个"l"替换成"p",并输出结果
# data = name.replace("l","p",1)
# print(data)
# - 将 name 变量对应的值根据 所有的"l" 分割,并输出结果
# data = name.split("l")
# print(data)
# - 将name变量对应的值根据第一个"l"分割,并输出结果
# data = name.split("l",1)
# print(data)
# - 将 name 变量对应的值变大写,并输出结果
# data = name.upper()
# print(data)
# - 将 name 变量对应的值变小写,并输出结果
# data = name.lower()
# print(data)
# - 请输出 name 变量对应的值的第 2 个字符?
# data = name[1:2]
# print(data)
# - 请输出 name 变量对应的值的前 3 个字符?
# data = name[0:3]
# print(data)
# - 请输出 name 变量对应的值的后 2 个字符?
# data = name[-3:-1]
# print(data)
s = "123a4b5c"
# - 通过对s切片形成新的字符串 "123"
# data = s.split("a")
# new_data = data[0]
# print(new_data)
# # - 通过对s切片形成新的字符串 "a4b"
# data = s.split("3")
# value = data[1]
# new_value = value.split("5")
# message = new_value[0]
# print(message)
# - 通过对s切片形成字符串s5,s5 = "c"
# s1 = s.split("5")
# s5 = s1[1]
# print(s5)
# - 通过对s切片形成字符串s6,s6 = "ba2"
# s = "123a4b5c"
# s6 = "ba2"
# s1 = s[-7:-2:2]
# s2 = s1[::-1]
# print(s2)
#使用while循环字符串 s="asdfer" 中每个元素。
# count = 0
# while count <=5:
# data = s[count]
# print(data)
# count+=1
#使用while循环对s="321"进行循环,打印的内容依次是:"倒计时3秒","倒计时2秒","倒计时1秒","出发!"。
# s="321"
# count = 3
# while count >=1:
# if count == 3:
# print("倒计时3秒")
# elif count == 2:
# print("倒计时2秒")
# else:
# print("倒计时1秒")
# count -= 1
# print("出发!")
# 实现一个整数加法计算器(两个数相加):如:content = input("请输入内容:") 用户输入:5+9或5+ 9或5 + 9(含空白),
# 然后进行分割转换最终进行整数的计算得到结果。
# content1 = input("请输入数字:")
# content2 = input("请输入数字:")
# if content1.isdigit()and content2.isdigit():
# data = content1 + content2
# print(data)
# else:
# print("输入错误,请输入数字!")
# content = input("请输入内容:") 错误!!!!!!
# data1 = content[0]
# data3 = content[2]
# v1 = data1.strip()
# v3 = data3.strip()
# a = int(v1)
# b = int(v3)
# total = a + b
# print(total)
# 计算用户输入的内容中有几个 h 字符?
#
# 如:content = input("请输入内容:") # 如fhdal234slfh98769fjdla
# content = input("请输入内容:")
# count = 0
# total = 0
# len = len(content)
# while count < len:
# data = content[count]
# if data == "h":
# total += 1
# print(data)
# count += 1
# print(total)
# 计算用户输入的内容中有几个 h 或 H 字符?
# 如:content = input("请输入内容:") # 如fhdal234slfH9H769fjdla
#
# content = input("请输入内容:")
# count = 0
# total = 0
# len = len(content)
# while count < len:
# data = content[count]
# if data == "h" or data == "H":
# total += 1
# print(data)
# count += 1
# print(total)
#使用while循环分别正向和反向对字符串 message = "伤情最是晚凉天,憔悴厮人不堪言。" 进行打印。
# message = "伤情最是晚凉天,憔悴厮人不堪言。"
# print(message)
# data = message[::-1]
# print(data)
# 获取用户输入的内容中 前4个字符中 有几个 A ?
#
# 如:content = input("请输入内容:") # 如fAdal234slfH9H769fjdla
# content = input("请输入内容:")
# # len = len(content)
# # count = 0
# # s = len - count
# # total = 0
# # while s > 0:
# # data = content[s - 1]
# # if data == "A":
# # total += 1
# # print(total)
# # s -= 1
#获取用户输入的内容,并计算前四位"l"出现几次,并输出结果。
# content = input("请输入内容:")
# len = len(content)
# count = 0
# s = len - count
# total = 0
# while s > 0:
# data = content[s - 1]
# if data == "1":
# total += 1
# print(total)
# s -= 1
# #获取用户两次输入的内容,并将所有的数据获取并进行相加,如:
# num1 = input("请输入:")
# num2 = input("请输入:")
# count = 0
#
# data1 = num1[count]
# data2 = num2[count]
# flag1 = data1.isdigit()
# if flag:
# print(data1)
# 不会将数字组合,下次更新解决