python第一单元笔记_python 初始第一课笔记

本文介绍了一个初学者用Python编写的程序,通过input()函数获取用户输入,演示了如何正确转换数据类型进行乘法运算,并讲解了如何让程序像Windows执行文件一样启动。重点在于理解用户输入和循环结构的应用。
摘要由CSDN通过智能技术生成

Python is the most popular open-source software in the world .When you want to control something ,it is worth your learning. Now let`s go to learn it together.

Firstly,i will introduce a program to you the one i finished it as long as i had learnt the first lecture from the wibsite-class Wangyiyun ,a Chinese website.

1. when we want people press their numbers that they think it so cool num,we can use the function -  input(no matter what you type here ,then when you enter ,the program will remind you to press the numbers that interest you. ) .Just like this:  a=input(),however,when we calculate the b=a*a,we will find it wrong.not will correct the struture of the a with a= int(a),then we can calculate b=a*a,perfect result,yes?

2. When we are intended to make the programs start just like exe in windows,we can use #!/usr/bin/env python3 (notice:it is only used in linux or unix)

The following is my copy programs with some changes there.

a=input("press your wanted numbers")

a=int(a)

b=a*a-a-1

c=a*b

if (a<1):

print("a<1")

print(c)

else:

print("a is not less than 1")

print(c-a)

print("we are done with the program")

The important is user`s number by themselves and the  loops here.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值