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

 










posted @ 2019-02-27 23:24  cc123nice  阅读(191)  评论(0编辑  收藏  举报