python day 03作业答案
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作业答案的更多相关文章
- Python面试真题答案或案例
Python面试真题答案或案例如下: 请等待. #coding=utf-8 #1.一行代码实现1--100之和 print(sum(range(1,101))) #2.如何在一个函数内部修改全局变量 ...
- C#基础第九天-作业答案-储蓄账户(SavingAccount)和信用账户(CreditAccount)
class Bank { //Dictionary<long,Account> dictionary=new Dictionary<long,Account>(); DataT ...
- C#基础第八天-作业答案-设计类-面向对象方式实现两个帐户之间转账
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- C#基础第七天-作业答案-利用面向对象的思想去实现名片-动态添加
class Card { private string name; public string Name { get { return name; } set { name = value; } } ...
- C#基础第六天-作业答案-利用面向对象的思想去实现名片
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- C#基础第五天-作业答案-用DataTable制作名片集
.DataTable 实现 DataTable PersonCard = new DataTable(); //创建一个DataTable DataTable PersonCardCopy = new ...
- C#基础第四天-作业答案-Hashtable-list<KeyValuePair>泛型实现名片
.Hashtable 实现 Hashtable table = new Hashtable(); while (true) { Console.WriteLine("------------ ...
- C#基础第三天-作业答案-集合-冒泡排序-模拟名片
.冒泡排序 Console.WriteLine("对集合里的数进行排序,请输入第一个数:"); int a = int.Parse(Console.ReadLine()); Con ...
- C#基础第二天-作业答案-九九乘法表-打印星星
题一:九九乘法表的答案 //正三角 ; i < ; i++) { ; j <= i; j++) { Console.Write("{0}*{1}={2} ", j, i ...
随机推荐
- Django之转发和重定向
https://blog.csdn.net/gscsd_t/article/details/79389167 转发和重定向: 转发:一次请求和响应,请求的地址没有发生变化,如果此时刷新页面,就会出现重 ...
- php打印
function preview() { bdhtml = window.document.body.innerHTML; sprnstr = "<!--startprint--> ...
- 在MongoDB中执行查询、创建索引
1. MongoDB中数据查询的方法 (1)find函数的使用: (2)条件操作符: (3)distinct找出给定键所有不同的值: (4)group分组: (5)游标: (6)存储过程. 文档查找 ...
- python, 在信用评级中,计算KS statistic值
# -*- coding: utf-8 -*- import pandas as pd from sklearn.grid_search import GridSearchCV from sklear ...
- windows配置教程
1.卸载预装软件 2.卸载非安装的预装软件 有些软件被改成了“绿色版”软件不能通过软件列表卸载,一般在C:\Program Files (x86)目录下 可以直接删除其文件夹,如果提示文件夹无法删除则 ...
- spring cloud jwt用户鉴权及服务鉴权
用户鉴权 客户端请求服务时,根据提交的token获取用户信息,看是否有用户信息及用户信息是否正确 服务鉴权 微服务中,一般有多个服务,服务与服务之间相互调用时,有的服务接口比较敏感,比如资金服务,不允 ...
- Android studio 一个项目引入另一个项目作为Libary
1.在我们开发Android项目时,有时需要一个项目作为另一个项目的工具类的引用,这样就需要配置下,使得MyLibrary到MyApplication作为一个module. 我们直接截图上步骤: 1. ...
- SpringBoot主程序类,主入口类
主程序类,主入口类 /** * @SpringBootApplication 来标注一个主程序类,说明这是一个Spring Boot应用 */ @SpringBootApplication publi ...
- MySql多个count查询
现有一个student表结构数据如下: id hight sex age 1 160 0 16 2 170 1 16 3 180 1 17 4 160 1 16 5 170 ...
- js之添加浏览器历史记录
如何生成一条历史记录 简单粗暴的方法,直接在当前页面的地址栏中输入地址 点击页面中有a标签的href 执行location.href = ‘xxx’(location.replace(‘xxx’)生成 ...