• day1学python Hello Python


    Hello Python

    本人使用的是Pycharm编译器

    -----------------------------------------------

    1.输出

    2.赋值

    3.‘’‘/“”“ 多行注释

    4.if-elif-else语句

    5.  while :  while和else联合判断! 若while后全部执行完执行else 后语句 见下方代码@@处!!!

    6.for语句 for i in range(10): 与c++和java不同 需要注意!

    7.在if/for等函数后 切记加:!!

    8.table格式要注意!只有上下位置对应时 表示同级概念     与c++和java不同 需要注意!

    ==============================================================

    Hello World

    # print("hello world")
    # name="2na "
    # '''
    # sda
    # '''
    # usename=input("name:")
    #
    # if(name==usename):
    #     print("welcome {}! ". format(usename))
    # else:
    #     print("{} is wrong ". format(usename))
    # print("over")

    ==============================================================
    循环与条件语句示例

    age=56
    count=0
    while(count<3):
        count=count+1
        if(age==int(input("age:"))):
            print("输入正确")
            break
        else:
            print("输入错误,请重新输入(已输入{}次)".format(count))
        if(count==3):
             confirm=input("do you want to contiue??")
             if(confirm!='n'):
                count=0
    
     else:
         print("输入错误次数超过三次!强制退出")
    for i in range(3):

        if(age==int(input("age:"))):
             print("输入正确")
             break
        else:
             print("输入错误,请重新输入(已输入{}次)".format(i+1))
        if(i==2):
    confirm=input("do you want to contiue??")
            if(confirm=='y'):
               i=0









  • 相关阅读:
    day3---字符串的索引与切片
    day4---int bool str之间相互转换
    day3---数据类型整体分析
    day2---while else
    day2---运算符
    day2---格式化输出
    ES6-04 Promise设计 类 模块
    jquery02-效果动画
    jquery01-基础使用
    bootstrap-03 常用重要组件(2)
  • 原文地址:https://www.cnblogs.com/cc123nice/p/10447780.html
Copyright © 2020-2023  润新知