zoukankan      html  css  js  c++  java
  • 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









  • 相关阅读:
    基础
    基础
    基础
    基础
    基础
    基础
    基础
    基础
    Gym102361A Angle Beats(直角三角形 计算几何)题解
    Petrozavodsk Summer Training Camp 2016H(多标记线段树)题解
  • 原文地址:https://www.cnblogs.com/cc123nice/p/10447780.html
Copyright © 2011-2022 走看看