Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Donate
Please sign in before you donate.
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
1 Star 0 Fork 1

aliao/stdpython

forked from pish7/stdpython
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
master
Branches (1)
master
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
The license selected for the repository is subject to the license used by the main branch of the repository.
master
Branches (1)
master
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
master
Branches (1)
master
a01.py 2.39 KB
Copy Edit Raw Blame History
pish7 authored 2025年12月13日 22:53 +08:00 . python class
from math import *
print("Hello Python world!")
message = "One of Python's strengths is its diverse community."
print(message)
# 下面将两条语句写在一行,语句之间用分号隔开
# message = "Hello Python world!"; print(message)
# print
print("a", "b", "c", sep="+", end="") # 自定义分隔符和结尾(结尾不换行)
print("a", "b", "c", sep="+", end="")
# a+b+ca+b+c
# 使用 Python 变量前必须给它赋值,因为 Python 变量没有默认值。
# 变量不需要声明数据类型
s1: int = 255
s2: int = 0xFF
s3: int = 0b11111111
s4: int = 0o377
# 同时给多个变量赋值
x, y, z = 1, 2, 3
# 复合赋值运算符
foo = 10
foo += 3
foo -= 4
# 整数的几种进制
# 整数始终是有符号的,实际上没有最大值
print(255, 0xFF, 0b11111111, 0o377) # 255 255 255 255
# 浮点数
print(3.3, 3e2)
f1 = float("inf") # 正无穷
f2 = float("-inf") # 负无穷
f3 = float(nan) # 非数,由于导入了 math 模块,所以可以使用 nan 而不是 "nan",inf 同理
print(f1, f2, f3)
# 数值之中只可以添加下划线
print(1_000_000)
# 乘方
print(3**2) # 9
# 浮点数
print(0.2 + 0.1) # 0.30000000000000004
# 将任意两个数相除,结果总是浮点数,即便这两个数都是整数且能整除
# 在其他任何运算中,如果一个操作数是整数,另一个操作数是浮点数,结果也总是浮点数
print(4 / 2) # 2.0
# 位运算
print(9 & 8)
print(9 | 8)
print(9 ^ 8)
print(~9)
print(9 << 2)
print(9 >> 2)
# 注意,del 只删除名称,而不删除值!可理解为解除名称与值的绑定。
# 如果有多个名称被绑定到同一个值,并且如果只删除其中一个名称,则其他名称及其值不受影响。
# 换句话说,del 不会强制垃圾回收器删除对象。
x = [1, 2, 3]
del x # 删除的是 x,[1,2,3] 是不会被删除的,但会在垃圾回收时被清除
x = [1, 2, 3]
del x[1]
# 若本文件用作运行程序,则执行以下代码,若是当作模块导入,则不执行
if __name__ == "__main__":
pass
# x = input("请输入一个小数,以及取整方式(0=向下取整,1=向上取整):")
# y = x.split()
# try:
# if int(y[1]) == 0:
# func = math.floor # 函数可使用值赋给某个变量
# if int(y[1]) == 1:
# func = math.ceil
# print(func(float(y[0]))) # float() 用于转换小数,int() 只能转换整数
# except:
# print("输入有误")
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

About

python 语法学习,demo 小示例
Cancel

Releases

No release

Contributors

All

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/aliaodc/stdpython.git
git@gitee.com:aliaodc/stdpython.git
aliaodc
stdpython
stdpython
master
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /