关于打印的Python问题 [英] Python problem regarding printing

查看:83
本文介绍了关于打印的Python问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我开始使用python解决Hackerrank的挑战。我遇到了一个问题。我是编码的初学者,如果有人可以帮我解决代码,那将会很棒。



问题陈述: - 读取整数N和输出应为'1,2,3 .... N'



例如: - 如果输入'5'则输出应为' 1,2,3,4,5'



我尝试过:



试图把它放到一个数组中,但输出就像[1,2,3,4,5],这不是所需的。

Hi,

I started solving challenges on Hackerrank using python. There is a problem I encountered. I am a beginner in coding and it would be great if someone could help me out with the code.

Problem statement:-Read an integer N and the output should be '1,2,3....N'

e.g:- If '5' is the input then output should be '1,2,3,4,5'

What I have tried:

Tried to put it into an array but the output is like [1,2,3,4,5] which isnt the desired one.

推荐答案

请查看 4。内置类型 - 范围() [ ^ ]以及 Python教程 - Python 3.4.8文档 [ ^ ]
Take a look at 4. Built-in Types — range()[^] and also The Python Tutorial — Python 3.4.8 documentation[^]


这篇关于关于打印的Python问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆