Python Basics and Built-in Functions Link

本文介绍了Python编程中表达式的概念,包括数值类型(整数、浮点数)、字符串及其操作(如*用于重复)。还讨论了变量的使用,将其比喻为计算机内存中的值存储箱,强调变量赋值后旧值将被遗忘。遵循的变量命名规则包括单一单词、不包含空格、只能用字母、数字和下划线,并且不能以数字开头。此外,提到了注释的使用(#号开始)和不同类型的运算符,如算术运算符和字符串连接。文章还提及了函数的基本形式,如print()和input(),并建议查阅内置函数文档以获取更多扩展信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

These rules for putting operators and values together to form expressions are a fundamental part of Python as a programming language, just like the grammar rules that help us communicate.

[Python Tutor - Visualize Python]

Remember that expressions are just values combined with operators, and they always evaluate down to a single value. A data type,say,The Integer, Floating-Point, and String Data Types.–> int(), float()and str(’ '),

The Interger :-5,0,35, 1,2,3

Floating point:-0.25, 2.3, 1.75

Strings are like ‘a’, ‘bbb’, ‘Hello world!’, ‘5 dogs’ The single quote should be 2 in the begin and end of strings.If just type one,then it will shown SyntaxError: EOL while scanning string literal. Cuz (’) characters are the signals for Python to known the strings begins and ends.

The *operator can be used with only two numeric values (for multiplication), or one string value and one integer value (for string replication).

Storing Values in Variables,Imaging Variables as a store value box in computer’s memory.When a variable is assigned a new value, the old value is forgotten.

When name a variable,3 principle rules as follows:

1.It can be only one word with no spaces.

2.It can use only letters, numbers, and the underscore (_) character.

3.It can’t begin with a number.

(P.S. Variable names are case-sensitive that means WE,we,We are 3 difference variables.)

Tool: >>> interactive shell and file editor(or say text editors such as Notepad or TextMate)

The hash mark # is part of comments are use for recording the notes.

Different types of operators +, -, *, /, //, %, and **for math operations,

+and *for string operations.

When write a function name, the opening and closing parentheses() at the end identify it as the name of a function.such as print(),input(),and len() functions.

Extension of built-in functions check up->[Built-in Functions — Python 3.9.6 documentation]
i潜能开发ONELiving

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值