hackerrank:Mutations

jlqwer 发表于 代码 分类,标签: Python 热度:147°
Wehaveseenthatlistsaremutable(theycanbechanged),andtuplesareimmutable(theycannotbechanged).Let'strytounderstandthiswithanexample.Youaregivenanimmutablestring,andyouwanttomakechangestoit.Example>>> string = "abracadabra"Youcanaccessanindexby:>>> print string[5]aWhatifyouwouldliketoassignava...

hackerrank:Python Print Function

jlqwer 发表于 代码 分类,标签: Python 热度:168°
ReadanintegerN.Withoutusinganystringmethods,trytoprintthefollowing:123...NNotethat"..."representsthevaluesinbetween.InputFormat Thefirstlinecontainsaninteger.OutputFormat Outputtheanswerasexplainedinthetask.SampleInput3SampleOutput123题目要求Withoutusinganystringmethods,可我没找到其他方法,有些不换行输出的方法后面带有一个空格,更加不符合题目要求,不过用字符串方法交上去是对的。代码如下:#!/usr/bin/pyt...