Python Forum
Stuck on python quiz challenge
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Stuck on python quiz challenge
#1
Hi Y'all.

I have recently purchased a book so I can teach my-self python. I'm just stick on one of the quizzes and need some guidance if possible. The question is :

Can you create a list l that prints [[1,2,3],[1,2,3]] but when I rotate only the first part by rotateRx(l[1]) and then print l it turns out that both parts have been rotated, i.e I get [[3,1,2],[3,1,2]].


I have tried to reproduce the output but only been able to rotate the second half. A bit baffled how you would rotate both. Any help would be appreciated.

My solution:

l=[[1,2,3],[1,2,3]]
def rotateRx4(alist):
         alist[0],alist[1],alist[2]=alist[-1],alist[0],alist[1]

    
rotateRx4(l[1])
print(l)
Reply


Messages In This Thread
Stuck on python quiz challenge - by baesian - Aug-15-2020, 06:08 PM
RE: Stuck on python quiz challenge - by bowlofred - Aug-15-2020, 07:48 PM
RE: Stuck on python quiz challenge - by scidam - Aug-16-2020, 12:52 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Beginner stuck in Python book for kids mic81k 11 1,322 Nov-27-2023, 04:28 AM
Last Post: deanhystad
  QUIZ GUI Form_When admin panel is open, main quiz form is getting freeze Uday 4 802 Aug-25-2023, 08:24 PM
Last Post: deanhystad
  PySpark Coding Challenge cpatte7372 4 6,175 Jun-25-2023, 12:56 PM
Last Post: prajwal_0078
  string format challenge jfc 2 1,814 Oct-23-2021, 10:30 AM
Last Post: ibreeden
  Learning python, stuck on some code. stanceworksv8 2 3,536 Apr-02-2019, 01:51 AM
Last Post: stanceworksv8
  Very difficult challenge for me cristfp 1 2,780 Apr-01-2019, 08:45 PM
Last Post: Yoriz
  Python Music Quiz lynden 6 12,557 Nov-12-2018, 12:31 PM
Last Post: Tashbf
  Challenge with my string SpencerH 3 2,964 Oct-12-2018, 11:58 AM
Last Post: SpencerH
  Complex Program with matplotlib - Python Challenge maggie_b 1 2,445 Apr-08-2018, 04:05 AM
Last Post: Larz60+
  I'm teaching myself python and i'm stuck... stormrider 2 3,037 Dec-06-2017, 10:16 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020