上代码前先上个东西:
直接输入 >>>‘11111111’ 与输入 >>>print('11111111') 有何不同?
没错,直接输入是将结果及类型打印到屏幕上,而print是将结果打印到屏幕上,自己试试并观察结果!
如下图:
下面给出我的第一个Python代码!
1.判断是否猜中的小游戏,源码如下:
- print("*************my first python demo*************")
- temp=input("please input a number which is in my mind: ")
- guess=int(temp)
- if guess==10:
- print("you are winner!")
- else:
- print("you are loser!")
- print("game over!")
2.输入字符串,再跟自己说你好,源码如下:
- nameStr=input("please input your name:")
- print("hello,"+nameStr);
3.判断输入的值是不是在这个范围,源码如下:
- num=input("please input a number while it's between 1 and 100:")
- if 1<=int(num)<=100:
- print("good boy!")
- else:
- print("you are son of bitch!")

![[手游] 三网H5小游戏【少年仙路】WIN系服务端+Linux手工服务端+详细搭建教程](https://cdn.jxasp.com:9143/image/20260615/136BC33AA47EB0D84E878835A8B38FDB.png)

















