当前位置:网站首页>Calculate the number of occurrences of a character
Calculate the number of occurrences of a character
2022-04-23 15:40:00 【Ye Ningxia Xin】
describe
Write a program , Accept a letter from 、 A string of numbers and spaces , And a character , Then output the number of occurrences of the character in the input string .( Case insensitive )
Data range : 1 \le n \le 1000 \1≤n≤1000
Input description :
On the first line, enter a string of letters and numbers and spaces , Enter a character on the second line .
Output description :
The number of characters in the output input string .( Case insensitive )
Example 1
Input :ABCabc A
Output :2
Their thinking : loop
content = input()
content1 = content.upper()
ch = input()
ch1 = ch.upper()
num = 0
for i in content1:
if i == ch1:
num += 1
print(num)
notes :b = list(a.lower()) # Convert all input characters to lowercase letters
b = list(a.upper()) # Convert all input characters to uppercase letters
版权声明
本文为[Ye Ningxia Xin]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231534071671.html
边栏推荐
- 软件性能测试报告起着什么作用?第三方测试报告如何收费?
- 【backtrader源码解析18】yahoo.py 代码注释及解析(枯燥,对代码感兴趣,可以参考)
- ICE -- 源码分析
- Mysql database explanation (10)
- Connect PHP to MSSQL via PDO ODBC
- Node. JS ODBC connection PostgreSQL
- cadence SPB17. 4 - Active Class and Subclass
- 幂等性的处理
- MySQL Cluster Mode and application scenario
- 携号转网最大赢家是中国电信,为何人们嫌弃中国移动和中国联通?
猜你喜欢
T2 icloud calendar cannot be synchronized
携号转网最大赢家是中国电信,为何人们嫌弃中国移动和中国联通?
How did the computer reinstall the system? The display has no signal
Mobile finance (for personal use)
Machine learning - logistic regression
For examination
Redis master-slave replication process
Codejock Suite Pro v20. three
木木一路走好呀
2022年中国数字科技专题分析
随机推荐
Machine learning - logistic regression
Special analysis of China's digital technology in 2022
KNN, kmeans and GMM
PHP 的运算符
Multi level cache usage
IronPDF for . NET 2022.4.5455
CAP定理
Node. JS ODBC connection PostgreSQL
布隆过滤器在亿级流量电商系统的应用
Demonstration meeting on startup and implementation scheme of swarm intelligence autonomous operation smart farm project
什么是CNAS认证?CNAS认可的软件测评中心有哪些?
【Leetcode-每日一题】安装栅栏
regular expression
PHP PDO ODBC将一个文件夹的文件装载到MySQL数据库BLOB列,并将BLOB列下载到另一个文件夹
Codejock Suite Pro v20. three
IronPDF for .NET 2022.4.5455
Control structure (I)
WPS品牌再升级专注国内,另两款国产软件低调出国门,却遭禁令
Connect PHP to MSSQL via PDO ODBC
Mobile finance (for personal use)