|

楼主 |
发表于 2023-10-26 14:15:14
|
显示全部楼层
所以最终的一个代码格式可能是这样子
<html>
<head>
<?php include './head_content.php'; ?>
</head>
<body>
<?php include './nav_content.php'; ?>
<div class="lowerBox">
<div class = "nav-stacked-left">
<?php include './head_python.php'; ?>
</div>
<div class="mainBox">
<h1>python基础</h1>
<h2><i class="fa fa-code"></i>第一个python程序:直接在IDLE中执行短程序 </h2>
<p>开始菜单找到<span class ="span_button_style">python</span>, 点击<span class ="span_button_style">IDLE</span>,打开界面</p>
<p>输入如下语句</p>
<pre>print("hello world");</pre>
<p>点击回车,在下一行出现hello world,程序运行完毕</p>
<p>可以看出,这个程序和C的语言,很类似,也满足f(x)的格式。</p>
<tips> IDLE 什么意思?
Integrated Development and Learning Environment,集成开发和学习环境,是Python的集成开发环境. </tips>
<h2><i class="fa fa-code"></i>更常用的方法:脚本中运行python程序 </h2>
<p>在IDLE shell中点击File-->new file,同样输入如下代码</p>
<pre>print("hello world");</pre>
<p>后保存为.py为后缀的文件后,点击F5运行,在IDLE shell中出现hello world,程序运行完毕</p>
<h2><i class="fa fa-code"></i>python中的关键字</h2>
<h3>1.if判断语句</h3>
<p></p>
<pre>
num = float(input("输入一个数字: "))
if num > 0:
print("正数")
elif num == 0:
print("零")
else:
print("负数")</pre>
<p>和C语言通过大括号定义级别不同,python通过缩进来定义,缩进相同认为是同一级别,所以书写缩进要严格</p>
<h3>2.for循环语句</h3>
<pre>
for i in "python":
print(i) </pre>
<p>for in结构,注意和C进行区分</p>
<h2><i class="fa fa-code"></i>综合联系:猜数字</h2>
<p>https://blog.csdn.net/weixin_67485407/article/details/123534099</p>
<?php
$taskId = "matlab_install";
include './finishTask.php';
?>
</div><!--mainbox-->
</div><!--lowerbox-->
<body>
</html> |
|