<jupyter_start><jupyter_text>基本程序设计- 一切代码输入，请使用英文输入法<jupyter_code>lena = mpimg.imread('photo')
print('fine!')<jupyter_output><empty_output><jupyter_text>编写一个简单的程序- 圆公式面积： area = radius \* radius \* 3.1415<jupyter_code>radius = eval(input('please input radius   '))
#type(radius)
print(radius * radius * 3.1415926)<jupyter_output><empty_output><jupyter_text>在Python里面不需要定义数据的类型  控制台的读取与输入- input 输入进去的是字符串- eval<jupyter_code>age = eval(inout('age'))<jupyter_output><empty_output><jupyter_text>- 在jupyter用shift + tab 键可以跳出解释文档  变量命名的规范- 由字母、数字、下划线构成- 不能以数字开头 \*- 标识符不能是关键词(实际上是可以强制改变的，但是对于代码规范而言是极其不适合)- 可以是任意长度- 驼峰式命名<jupyter_code>((3+4*x)/5)+(10*(y-5)*(a+b+c)/x)+(9((4/x)+(9+x)/y))<jupyter_output><empty_output><jupyter_text>变量、赋值语句和赋值表达式- 变量: 通俗理解为可以变化的量- x = 2 \* x + 1 在数学中是一个方程，而在语言中它是一个表达式- test = test + 1 \* 变量在赋值之前必须有值  同时赋值var1, var2,var3... = exp1,exp2,exp3...  定义常量- 常量：表示一种定值标识符，适合于多次使用的场景。比如PI- 注意：在其他低级语言中如果定义了常量，那么，该常量是不可以被改变的，但是在Python中一切皆对象，常量也是可以被改变的  数值数据类型和运算符- 在Python中有两种数值类型（int 和 float）适用于加减乘除、模、幂次  运算符 /、//、**  运算符 %  EP：- 25/4 多少，如果要将其转变为整数该怎么改写- 输入一个数字判断是奇数还是偶数- 进阶: 输入一个秒数，写一个程序将其转换成分和秒：例如500秒等于8分20秒- 进阶: 如果今天是星期六，那么10天以后是星期几？ 提示：每个星期的第0天是星期天<jupyter_code>deshu = int(25/4)
print (deshu)
shuzi =int(input('input an number'))
if  shuzi % 2 == 0:
    print('shuzi是偶数')

else:
    print('shuzi是奇数')

seconds = int(input('input a second number   '))
mum = int(seconds/60)
sec = int(seconds%60)
print('现在是{}分{}秒'.format(mum,sec))
date,days = eval(input('input date today and a day number'))

fut = int((date+days)%7)
print('十天后是星期{}'.format(fut))<jupyter_output><empty_output><jupyter_text>科学计数法- 1.234e+2- 1.234e-2<jupyter_code>1.234e-2<jupyter_output><empty_output><jupyter_text>计算表达式和运算优先级  增强型赋值运算  类型转换- float  -> int- 四舍五入 round  EP:- 如果一个年营业税为0.06%，那么对于197.55e+2的年收入，需要交税为多少？(结果保留2为小数)- 必须使用科学计数法  Project- 用Python写一个贷款计算器程序：输入的是月供(monthlyPayment) 输出的是总还款数(totalpayment)![](../Photo/05.png)  Homework- 1<jupyter_code>ce =eval(input('Enter a degree in Celsius: '))
fa = float((9/5)*ce+32)
print('{} Celsius is {} Fahrenheit'.format(ce,fa))<jupyter_output><empty_output><jupyter_text>- 2<jupyter_code>import math
ra,le = eval(input('Enter the radius and length of a cylinder'))
area = round(ra*ra*3.14159,4)
volume = round(area*le,2)
print ('The area is {}''\nThe volume {}'.format(area,volume))<jupyter_output>Enter the radius and length of a cylinder5.5,12
The area is 95.0331
The volume 1140.4<jupyter_text>- 3<jupyter_code>dry<jupyter_output><empty_output><jupyter_text>- 4<jupyter_code>and...<jupyter_output><empty_output><jupyter_text>- 5<jupyter_code>ba,inte = eval(input ('Enter balance and interest rate (e.g.,3 for 3%): ') )
lx = round(ba*inte/1200,5)
print('The inerest is {}'.format(lx))<jupyter_output>Enter balance and interest rate (e.g.,3 for 3%): 1000,3.5
The inerest is 2.91667<jupyter_text>- 6<jupyter_code>Oh..<jupyter_output><empty_output><jupyter_text>- 7 进阶<jupyter_code>money = float (input('enter the monthly saving amount :'))
all = round(money*(1+0.00417)+(money*(1+0.00417)**2)+(money*(1+0.00417)**3)+(money*(1+0.00417)**4)+(money*(1+0.00417)**5)+(money*(1+0.00417)**6),2)
print('After the sixth month,the account value is {}'.format(all))<jupyter_output>enter the monthly saving amount :100
After the sixth month,the account value is 608.82<jupyter_text>- 8 进阶<jupyter_code>nu = int(input('Enter number between 0 and 1000:'))
na = int(nu%10)
nc = int(nu//100)
nm = int(nu//10)
nb = int(nm%10)
sum = (na+nb+nc)
print('The sum of the digits is {}'.format(sum))<jupyter_output>Enter number between 0 and 1000:999
The sum of the digits is 27
{'fraction_non_alphanumeric': 0.1718576195773081, 'fraction_numerical': 0.060066740823136816, 'mean_word_length': 7.046979865771812, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 54, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '14', 'dir': 'jupyter-structured-clean-dedup', 'id': '624659', 'license': 'Apache-2.0', 'n_tokens_mistral': 1995, 'n_tokens_neox': 1954, 'n_words': 260, 'path': '7.16.ipynb', 'repo_name': 'db19860128/ppp', 'size': '3596'}