美文网首页
Python-11~15题

Python-11~15题

作者: AoEliauk | 来源:发表于2020-08-18 15:19 被阅读0次

---11---

Question:

>Write a program which accepts a sequence of comma separated 4 digit binary numbers as its input and then check whether they are divisible by 5 or not. The numbers that are divisible by 5 are to be printed in a comma separated sequence.

>Example: 0100,0011,1010,1001

>Then the output should be:1010

Hints:

>In case of input data being supplied to the question, it should be assumed to be a console input.

Solution:

解法一:

解法二:

解法三:

result

---12---

Question:

>Write a program, which will find all such numbers between 1000 and 3000 (both included) such that each digit of the number is an even number.The numbers obtained should be printed in a comma-separated sequence on a single line.

Hints:

In case of input data being supplied to the question, it should be assumed to be a console input.

Solution:

解法一:

解法二:

。。。

---13---

Question:

>Write a program that accepts a sentence and calculate the number of letters and digits.

>Suppose the following input is supplied to the program:hello world! 123

>Then, the output should be:

LETTERS 10

DIGITS 3

Solution:

解法一:

解法二:

上述两种解决方法中显示了两种不同地格式化方法

result

解法三:

program(3) result

---14---

Question:

>Write a program that accepts a sentence and calculate the number of upper case letters and lower case letters.

>Suppose the following input is supplied to the program:Hello world!

>Then, the output should be:

UPPER CASE 1

LOWER CASE 9

Solution:

解法一:

解法二:

代码与解法一 一样,打印方法不同。

解法三:

结果:

解法四:

result

---15---

Question:

>Write a program that computes the value of a+aa+aaa+aaaa with a given digit as the value of a.

>Suppose the following input is supplied to the program: 9

>Then, the output should be: 11106

解法一:

解法二:

result

相关文章

  • Python-11~15题

    ---11--- Question: >Write a program which accepts a seque...

  • 推断题答案

    导向卷四——15题 宁德卷15题 龙岩卷14题 莆田卷15题 三明卷15题 福州卷15题 漳州卷14题

  • 工艺流程题答案

    导向卷三——15题 导四——14题 导五——15题 导六——15题 泉州卷14题 宁德卷14题 龙岩卷15题 厦门...

  • python-11 继承

    例子,卡牌继承 继承 类之间有如下几种关系: 一个类中的对象可以包含对另外一个类的对象的引用。例如,每一个矩形包含...

  • 命题说题6

    第9题 第14题初稿 第14题定稿 第15题初稿 第15题定稿 第25题初稿 第25题定稿 第26题 第28题 ...

  • 2015-2022年高考数学函数与导数专题函数图象与零点方程根(

    数形结合,快速解析2022年高考天津卷数学试题填空压轴题——第15题 填空压轴题:2021年高考北京卷数学第15题...

  • 试卷分析

    15题试题分析: 15题难度系数为0.53,满分4分,全级平均得分1.78分,得分率45%。这一题题目其实不难,但...

  • 每日必做

    晨起喝一杯水 背英语单词 齐麟资析20题,打卡 整齐使用草稿纸 每日常识10题 每日言语15题 每日判断15题 学...

  • Bugku-INSERT INTO 注入

    INSERT INTO 注入 原题链接 http://120.24.86.145:8002/web15/ 分析 题...

  • NJUPT《 公司人力资源管理 》

    一、考试说明 1)单项选择,15题,共15分;2)名词解释,5题,共20分;3)简答题,5题,共30分;4)案例分...

网友评论

      本文标题:Python-11~15题

      本文链接:https://www.haomeiwen.com/subject/vtkbdktx.html