|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
大家好!我想请教一下如何输出:
Your age is 19. You are an adult.
呢?
age=19
if age>=18:
print('Your age is',age'.You are an adult')
else:
print('Your age is',age'.You are an teenager')
上述命令我应该怎么修改呢?
小白跪谢!!!
本帖最后由 txxcat 于 2020-4-21 01:04 编辑
这样?
- >>> age=19
- >>> print('Your age is',age,'.You are an adult.')
- Your age is 19 .You are an adult.
- >>> print('Your age is {0}.You are an adult.'.format(age))
- Your age is 19.You are an adult.
- >>> print('Your age is %d.You are an adult.' % age)
- Your age is 19.You are an adult.
复制代码
|
|