1.

(10)

name='aleX leNb'
print(name.split('l',1))

(13)

name='aleX leNb'
a=name.replace('a','A')
print(a)

(14)

name='aleX leNb'
count=0
for i in name:
if i =='l':
count+=1
print(count)

(15)

name='aleX leNb'
count=0
for i in name[0:4]:
if i =='l':
count+=1
print(count)

(16)

name='aleX leNb'
print(name.index('N'))

(17)

name='aleX leNb'
print(name.find('N'))

2.

(6)

s='123a4b5c'
print(s[-3::-2])

3.

s='123a4b5c'
for i in s :
print(i)

4.

s='123a4b5c'
for i in range(0,len(s)) :
print(s+'sb')

5.

s='abcdefg'
for i in s:
print(str(i)+'sb')

6.

s=''
for i in s:
print('倒计时%s秒' %i)

7.

count=input('请输入内容:').strip()
a=count.split('+')
b=int(a[0])+int(a[1])
print(b)

8.

count=input('请输入内容:').strip()
a=count.split('+')
b=0
for i in range(0,len(a)):
b=b+int(a[i])
print(b)

9.

count=input('请输入内容:').strip()
a=0
for i in count:
if i.isdigit():
a=a+1
print(a)

10.

a=input('请输入:').upper()
while 1:
if a=='A':
print('走大路回家')
b=input('公交车还是步行?')
if b=='公交车':
print('十分钟到家')
break
elif b=='步行':
print('20分钟回家')
break
elif a=='B':
print('走小路回家')
break
elif a=='C':
print('绕道回家')
c=input('游戏厅还是网吧?')
if c=='游戏厅':
print('你爸爸会打死你,给我重新选A,B,C')
elif c=='网吧':
print('你妈会打死你,给我重新选A,B,C')
else:print('傻逼')

11.

count=0
sum=0
while count <99:
count = count + 1
if count==88:
continue
if count %2!=0:
sum=sum+count
elif count %2==0:
sum=sum-count
print(sum)

12.

a=input('')
if a[-1::-1]==a:
print('回文')

13.

a=input('')
digit_num = 0
upper_num=0
lower_num=0
for i in a:
if i.isdigit():
digit_num+=1
elif i.isupper():
upper_num+=1
elif i.islower():
lower_num+=1
print(digit_num)
print(upper_num)
print(lower_num)

14.

name=input('姓名')
place=input('地点')
hobby=input('爱好')
print('敬爱的{}喜欢在{}{}'.format(name,place,hobby))

python day 03作业答案的更多相关文章

  1. Python面试真题答案或案例

    Python面试真题答案或案例如下: 请等待. #coding=utf-8 #1.一行代码实现1--100之和 print(sum(range(1,101))) #2.如何在一个函数内部修改全局变量 ...

  2. C#基础第九天-作业答案-储蓄账户(SavingAccount)和信用账户(CreditAccount)

    class Bank { //Dictionary<long,Account> dictionary=new Dictionary<long,Account>(); DataT ...

  3. C#基础第八天-作业答案-设计类-面向对象方式实现两个帐户之间转账

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  4. C#基础第七天-作业答案-利用面向对象的思想去实现名片-动态添加

    class Card { private string name; public string Name { get { return name; } set { name = value; } } ...

  5. C#基础第六天-作业答案-利用面向对象的思想去实现名片

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  6. C#基础第五天-作业答案-用DataTable制作名片集

    .DataTable 实现 DataTable PersonCard = new DataTable(); //创建一个DataTable DataTable PersonCardCopy = new ...

  7. C#基础第四天-作业答案-Hashtable-list<KeyValuePair>泛型实现名片

    .Hashtable 实现 Hashtable table = new Hashtable(); while (true) { Console.WriteLine("------------ ...

  8. C#基础第三天-作业答案-集合-冒泡排序-模拟名片

    .冒泡排序 Console.WriteLine("对集合里的数进行排序,请输入第一个数:"); int a = int.Parse(Console.ReadLine()); Con ...

  9. C#基础第二天-作业答案-九九乘法表-打印星星

    题一:九九乘法表的答案 //正三角 ; i < ; i++) { ; j <= i; j++) { Console.Write("{0}*{1}={2} ", j, i ...

随机推荐

  1. 『MXNet』第一弹_基础架构及API

    MXNet是基础,Gluon是封装,两者犹如TensorFlow和Keras,不过得益于动态图机制,两者交互比TensorFlow和Keras要方便得多,其基础操作和pytorch极为相似,但是方便不 ...

  2. 通过selenium控制浏览器滚动条

    目的:通过selenium控制浏览器滚动条 原理:通过 driver.execute_script()执行js代码,达到目的 driver.execute_script("window.sc ...

  3. Wannafly挑战赛22-A/B/C

    链接:https://www.nowcoder.com/acm/contest/160/A来源:牛客网 题目描述 有一个计数器,计数器的初始值为0,每次操作你可以把计数器的值加上a1,a2,...,a ...

  4. 兼容IE8的video写法

    <video width="100%" height="515px" controls preload> <source src=" ...

  5. Fastjson, Gson, org.json.JSON三者对于JSONObject及JSONArray的判断

    1.Fastjson 我们通常在已知格式的情况下直接使用JSONObject,JSONArray,但是如果遇到需要判断格式呢? try{ Object object = JSON.parse(a); ...

  6. 在js中if条件为null/undefined/0/NaN/""表达式时,统统被解释为false,此外均为true

    Boolean 表达式 一个值为 true 或者 false 的表达式.如果需要,非 Boolean 表达式也可以被转换为 Boolean 值,但是要遵循下列规则: 所有的对象都被当作 true. 当 ...

  7. linux git:fatal: HTTP request failed

    问题 问题的出现比较奇怪 我一台电脑 git clone   没问题 另外一台电脑  git  clone  有问题 解决 yum update nss nss-util nspr 参考 https: ...

  8. ubuntu启用root登陆

    ubuntu系统不能够默认以root用户登陆系统如果你为了方便开发想每次登陆的时候以root用户登陆那么需要手动的做写更改打开终端 首先输入命令 sudo passwd  root更新你的密码然后输入 ...

  9. :状态模式:GumballMachine

    #ifndef __STATE_H__ #define __STATE_H__ #include <iostream> #include<stdlib.h> using nam ...

  10. delete请求

    Action(){ int HttpRetCode; //定义一个变量,用于接收HTTP返回的状态码 web_add_header("Session-Id", "2e25 ...