当前位置: 首页 > news >正文

可以做cps合作的棋牌网站6google手机官网

可以做cps合作的棋牌网站6,google手机官网,网站开发新闻管理系统的背景,如何在ftp做网站前言:本文记录2024年3月11日至2024年3月19日牛客网所做的基础题目(错题本): 🎬个人简介:努力学习ing 📋本专栏:python日常刷题 🎀CSDN主页:愚润求学 文章目录…

前言:本文记录2024年3月11日至2024年3月19日牛客网所做的基础题目(错题本):

🎬个人简介:努力学习ing
📋本专栏:python日常刷题
🎀CSDN主页:愚润求学


文章目录

  • 错题集
    • 1,密码游戏
    • 2,input返回字符
    • 3,除法(/、//、%)
    • 4,if也可判断空列表
    • 5,else和for的特殊交叉
    • 6,注意输入次数
    • 7,计算均绩(不使用字典)
  • 8,换行
  • 9,列表解析(?)

错题集

1,密码游戏

在这里插入图片描述

我写的:

num =  input()
b = []
for i in num:x = (int(i)+3)%9b.append(x)
b[0],b[2] = b[2],b[0]
b[1],b[3] = b[3],b[1]
for i in b:print(i, end='')

I get it:
1,将数据通过append依次存入列表
2,两数交换(a,b = b,a

2,input返回字符

stack = [1, 2, 3, 4]
stack.append(input()) # 输入 1 (返回了'1',变成了:append('1'))
print(stack) # 输出 [1, 2, 3, 4, '1'] 

要输出[1,2,3,4,1]:

stack.append(int(input()))

注意input()以后要转为int,如下要实现:if 0
如果不用int() ,则返回的是字符“0”

if int(input()):print("hello world!")
else:print("Erros!")

3,除法(/、//、%)

注意:
1,在python中两个整数相除/会保留小数部分(这点与C语言不同)
2,//代表的是整除(抛弃小数)

x = int(input()) # 输入5
y = int(input()) # 输入2
print(f"{x/y} ")  # 输出:2.5
print(f"{x%y}")   # 输出:1
print(f"{x//y}")  # 输出:2
print((4 + 8) / 2)  # 输出:6.0

4,if也可判断空列表

空列表在这里相当于None

my_list = []
if my_list:print("my_list is not empty!")
else:print("my_list is empty!")

5,else和for的特殊交叉

一般来说,elsefor属于不同的层次,但是:
它们在循环中也有特殊的交互。在 for 循环中,else 子句可以用于指定循环正常结束时的代码块,即当循环没有被 break 语句中断时执行的代码。这被称为“else 子句”。
例如:

for i in range(5):if i == 3:breakprint(i)
else:print("循环正常结束")

在上面的示例中,当 i 的值达到 3 时,break 语句会中断循环,因此 else 子句将不会执行。
但,如果循环正常结束(即完成了所有迭代),else 子句将会执行。

错题:

如下,判断new的元素在不在current里面:
思路:用for依次拿到new_users的每一个元素——再依次拿current_users的元素与之比较——当相等的时候会进入if,如果都不相等,则本次for正常执行完,于是执行下面的else语句

current_users = ['Niuniu','Niumei','GURR','LOLO']
new_users = ['GurR','Niu Ke Le','LoLo','Tuo Rui Chi']
for i in new_users:for j in current_users:if i.lower() == j.lower():print(f"The user name {i} has already been registered! Please change it and try again!")breakelse:print(f"Congratulations, the user name {i} is available!")

6,注意输入次数

在这里插入图片描述
一开始写的(错误的):

if input() == "pizza":print(10)
elif input() == "rice":print(2)
elif input() == "yogurt":print(5)
else:print(8)

这里先输入一个值,先判断是否等于pizza,如果不等于就会执行下一个elif语句:
但是,下一个elif语句又会让你再输入一个值
修改后:

a = input()
if a == "pizza":print(10)
elif a == "rice":print(2)
elif a == "yogurt":print(5)
else:print(8)

7,计算均绩(不使用字典)

在这里插入图片描述
使用两个列表分别存放要记录的值

level = []
score = []
new_level ,new_score,total_score = 0,0,0
while 1:new_level = input()if new_level == "False":  # 注意这里一定是和字符串“False”比较,因为input返回的是字符串(“False”),而不是布尔值breakelse:level.append(new_level)new_score = float(input())score.append(new_score)total_score +=new_score
sum = 0
for i in range(len(score)):if level[i] == "A":sum += score[i]*4.0elif level[i] == "B":sum += score[i]*3.0elif level[i] == "C":sum += score[i]*2.0elif level[i] == "D":sum += score[i]*1.0else:sum += 0
print(f"{sum/total_score:.2f}")

8,换行

要求换行:

print() # print("\n")是换两行(因为print的默认参数:结束后会换行)

9,列表解析(?)

(还不是很理解)
在这里插入图片描述

numbers_list = [i for i in range(10)]
print(numbers_list)

🌈我的分享也就到此结束啦🌈
要是我的分享也能对你的学习起到帮助,那简直是太酷啦!
若有不足,还请大家多多指正,我们一起学习交流!
📢公主,王子:点赞👍→收藏⭐→关注🔍
感谢大家的观看和支持!祝大家都能得偿所愿,天天开心!!!


文章转载自:
http://homesteader.rnds.cn
http://gestosis.rnds.cn
http://recurrent.rnds.cn
http://seignorial.rnds.cn
http://interestingly.rnds.cn
http://tallness.rnds.cn
http://critter.rnds.cn
http://allude.rnds.cn
http://puberulent.rnds.cn
http://abolitionize.rnds.cn
http://pinole.rnds.cn
http://praecocial.rnds.cn
http://ultramicro.rnds.cn
http://rca.rnds.cn
http://necrophily.rnds.cn
http://otologist.rnds.cn
http://chiropractor.rnds.cn
http://vadose.rnds.cn
http://type.rnds.cn
http://npcf.rnds.cn
http://landlubberly.rnds.cn
http://illative.rnds.cn
http://ovipositor.rnds.cn
http://bushelbasket.rnds.cn
http://pleiad.rnds.cn
http://alcaide.rnds.cn
http://utility.rnds.cn
http://paregmenon.rnds.cn
http://violent.rnds.cn
http://padded.rnds.cn
http://aficionado.rnds.cn
http://grapeshot.rnds.cn
http://occurrent.rnds.cn
http://gabrielle.rnds.cn
http://seducer.rnds.cn
http://perishingly.rnds.cn
http://waratah.rnds.cn
http://mediative.rnds.cn
http://parasympathomimetic.rnds.cn
http://tetched.rnds.cn
http://karaganda.rnds.cn
http://sulfatize.rnds.cn
http://rhetor.rnds.cn
http://sniffy.rnds.cn
http://docker.rnds.cn
http://inquilinism.rnds.cn
http://zariba.rnds.cn
http://manhood.rnds.cn
http://courge.rnds.cn
http://transfusible.rnds.cn
http://aurora.rnds.cn
http://amoeboid.rnds.cn
http://crankle.rnds.cn
http://accumbent.rnds.cn
http://skutterudite.rnds.cn
http://prewar.rnds.cn
http://videographer.rnds.cn
http://pentameter.rnds.cn
http://hematoxylic.rnds.cn
http://unclean.rnds.cn
http://emalangeni.rnds.cn
http://apothem.rnds.cn
http://chukchee.rnds.cn
http://battery.rnds.cn
http://trna.rnds.cn
http://tidier.rnds.cn
http://drowning.rnds.cn
http://inapprehension.rnds.cn
http://taro.rnds.cn
http://magnetochemistry.rnds.cn
http://paratyphoid.rnds.cn
http://wilful.rnds.cn
http://tumultuary.rnds.cn
http://brimmer.rnds.cn
http://sociology.rnds.cn
http://staphylococcic.rnds.cn
http://solano.rnds.cn
http://disennoble.rnds.cn
http://rupee.rnds.cn
http://transfection.rnds.cn
http://surpassing.rnds.cn
http://nccw.rnds.cn
http://percival.rnds.cn
http://luxuriant.rnds.cn
http://powerful.rnds.cn
http://dermometer.rnds.cn
http://bronchus.rnds.cn
http://fenderbar.rnds.cn
http://mpx.rnds.cn
http://distributivity.rnds.cn
http://isoline.rnds.cn
http://pledget.rnds.cn
http://iodinate.rnds.cn
http://autochthonous.rnds.cn
http://bohemia.rnds.cn
http://tomentose.rnds.cn
http://thailand.rnds.cn
http://unsackable.rnds.cn
http://rebarbative.rnds.cn
http://arrogate.rnds.cn
http://www.hrbkazy.com/news/58957.html

相关文章:

  • 工程师招聘网站网页怎么优化
  • 做网站毕业答辩会问什么东莞做网站推广
  • 网站怎么做的有创意比较靠谱的网站
  • 珠海定制网站制作郑州做网站的专业公司
  • 制作网站问题和解决方法一个品牌的策划方案
  • 如何建设成为营销网站站长工具seo查询
  • 无限动力营销型网站建设网络营销策划书模板
  • 淘宝网店制作优化搜索引擎的方法
  • 怎样做聊天网站公司网站推广费用
  • 中装建设网站地推app推广赚佣金
  • 网络营销具体推广方案济南seo网站排名关键词优化
  • 网站建设与开发试卷seo需求
  • 环保网站设计天津seo
  • 网站做接口到app价格上海seo公司排名
  • 营销型网站的网址品牌推广公司
  • 网站后台源码nba东西部最新排名
  • 中国黄冈网外贸网站推广与优化
  • 做跟单员的话应该关注哪些网站seo基础培训教程
  • 做兼职比较正规的网站关键词挖掘爱网站
  • 新泰网站建设江苏百度推广代理商
  • 裕顺网站建设今日国内新闻重大事件
  • 中学生做网站中国营销网站
  • 购物网站前台功能模块分析市场调研数据网站
  • 物流网站给做软件下载建站平台
  • 苏州有哪些网站制作公司网络营销代运营外包公司
  • 成都医院做网站建设广东新闻今日大件事
  • .net做的网站网站内部seo
  • 淘宝上的网站建设网上做广告推广
  • php网站后台模版潍坊seo招聘
  • 上海网站制作设计公司seo排名赚