# Circulate the values of n variables
no_of_terms = int(input("Enter number of values : "))
#Read values
list1 = []
for val in range(0,no_of_terms,1):
ele = int(input("Enter integer : "))
list1.append(ele)
#Circulate and display values
print("Circulating the elements of list ", list1)
for val in range(0,no_of_terms,1):
ele = list1.pop(0)
list1.append(ele)
print(list1)
Good Solution, Are there any alternate solutions to do a comparative study?
ReplyDeleteAlternative solutions
ReplyDeleteUse a nested for loop and just print the values based on index. Don't actually disturb the list. Just the display based on index.
Tried them both. But the pop, append and display was the most efficient.
I'm a beginner where I can learn Python well?
ReplyDeletefor beginners - Think Python by Allen Downey, Green Tea Press is good
DeletePython Essential Reference by David Beazley for more advanced content and explanations
Core Python Programming by Wesley J. Chun
use online tutorials for more examples
only way to learn a programming language is by doing programs
practice all the assignment problems i have posted.
all the best. happy programming
Nalla program
ReplyDeleteMadam I think last line print Statement should come after the loop.not inside the loop..
ReplyDeleteexecute the program and see.
Deletefirst element is removed and appended to the end position and all the values in the list are moved by one position.
This repeats until they reach their original position.
print statement is given inside the loop to display the element position each time they are moved.
circulate the value in two n variables-program,algorithm,
ReplyDeleteflow chart,pseudo code,......
mam pls upload a algorithm for this program
ReplyDeleteGreat Work ?Mam.....
ReplyDeleteIt will be better with algorithms
ReplyDelete