PHP8.1.21版本已发布
vue8.1.21版本已发布
jquery8.1.21版本已发布

Python语法练习--字符串格式化

黄舟
黄舟 原创
2016-12-28 17:23:41 1325浏览

python</a>;toolbar:false">#!/usr/bin/env python  
# -*- coding:utf8 -*-  
  
w_sex = "女"  
m_sex = "男"  
w_age = 23  
m_age = 25  
  
sex_input = input("请输入您的性别:").strip()  
age_input = int(input("请输入您的年龄:"))  
  
if sex_input == w_sex and age_input >= w_age:  
    print ("您的信息如下:\n性别:%s\n年龄:%s\n您属于晚婚年龄" %(sex_input,age_input))  
elif sex_input == m_sex and age_input >= m_age:  
    print ("您的信息如下:\n性别:%s\n年龄:%s\n您属于晚婚年龄" %(sex_input,age_input))  
else:  
    print ("输入错误,系统退出")

 以上就是python语法练习--字符串格式化的内容,更多相关内容请关注php中文网(www.php.cn)!

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。