1.使用input实现学生注册信息,信息包括姓名、性别、地址、生日、电话、邮箱 2.使用print的%s和{}形式输出注册的信息
时间: 2023-12-29 13:06:21 浏览: 16
好的,您可以输入以下代码实现学生注册信息的输入和输出:
```python
# 使用 input 实现学生注册信息的输入
name = input("请输入姓名:")
gender = input("请输入性别:")
address = input("请输入地址:")
birthday = input("请输入生日:")
phone = input("请输入电话号码:")
email = input("请输入邮箱:")
# 使用 print 的 %s 形式输出注册的信息
print("以下是您注册的学生信息:")
print("姓名:%s" % name)
print("性别:%s" % gender)
print("地址:%s" % address)
print("生日:%s" % birthday)
print("电话:%s" % phone)
print("邮箱:%s" % email)
# 使用 print 的 {} 形式输出注册的信息
print("以下是您注册的学生信息:")
print("姓名:{}".format(name))
print("性别:{}".format(gender))
print("地址:{}".format(address))
print("生日:{}".format(birthday))
print("电话:{}".format(phone))
print("邮箱:{}".format(email))
```
运行代码后,您可以按照提示输入学生的注册信息,程序会输出您输入的信息。其中,使用了 %s 和 {} 两种形式的占位符,分别代表字符串类型的变量,用于输出字符串类型的变量值。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)