Day 13 Python 一之helloworld

本文提供了多个Python编程实例,包括用户登录验证、数字求和、输出特定数字序列等,通过实际操作帮助初学者掌握Python基本语法及流程控制。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

直接肝程序吧!

"""
# 作业六:用户登录测试(三次机会)

count = 1
while count <= 3:
    user = input('请输入用户名: ')
    password = input ('请输入密码: ')
    if user == 'dachao' and password == '123':
        print ('你真厉害!!!')
        break
    else:
        print ('再试一次呦!')
        count+=1
"""



"""
# 作业四:输出1-100内所有的偶数

i = 1
while i <= 100:
    if i%2 == 0:
        print (i)
    i+=1
"""
"""
# 作业三:输出1-100内的所有奇数

i = 1
while i <= 100:
    if i%2 != 0:
        print (i)
    i+=1
"""

"""
# 作业二:求1-100的所有数的和

i = 1
sum = 0
while i <= 100:
    sum = sum + i
    i+=1
print (sum)

"""

"""
# 作业一:while 循环输出1 2 3 4 5 6  8 9 10 无7 !!!

i = 1
while i <= 10:
    if i !=7:
        print (i)
  #      i+=1
  #  else:
  #      i+=1
  #      continue
    i+=1
"""



"""
name = input ('请输入用户名: ')
password = input ('请输入密码: ')

if name == 'dachao' and password == '123':
    print ('user login successful')
else:
    print ('user or code is wrong!')

"""
"""
#通过tag的True赋值,实现用户名和密码必须为真进行下一步,否则无线循环的目的。
tag = True
while tag :
    username = input ('input username: ')
    password = input ('input password: ')
    if username == 'dachao' and password == '123' :
        while tag :
            cmd = input ('>>: ')
            if cmd == 'q' :
                tag = False
                continue
            print ('------->%s' %cmd)

"""
"""
#九九乘法表
for i in range(1,10) :
    for j in range(1,i+1) :
        print ('%d*%d=%d' %(i,j,i*j),end = ' ')
    print ()    #每次执行语句自动占用一行,“/n”代表空一行
"""

"""
name = input ('请输入用户名: ')

if name == 'dachao' :
    print ('你最牛逼!')
elif name == 'xiaochao' :
    print ('你可以的!')
else:
    print ('你还需努力呢!')

"""

"""
while True:
    print ('123')
    print ("456")
    continue
    
"""
"""
import getpass
password = getpass.getpass ('请输入密码: ')
print (password)
#自带idle不支持隐藏回显。

"""
Python入门

 

转载于:https://www.cnblogs.com/LiChaoAI/p/6952643.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值