Skip to content
Pooja Bhatia Classes Hari Nagar
  • We teach following classes
    • Class 12
    • Class 11
    • Class 10
    • Class 9
  • Sumita Arora IP/CS Solutions
  • Jobs/Internship
Pooja Bhatia Classes Hari Nagar

sa 12 cs

2. A line of text is read from the input terminal into a stack. Write an program to output the string in the reverse order, each character appearing twice.

sa 12 cs chapter 10 / PythonCSIP CS IP

(e.g., the string aJb c d e should be changed to ee dd cc bb aa)

2. A line of text is read from the input terminal into a stack. Write an program to output the string in the reverse order, each character appearing twice. Read More »

3. Write a program that depending upon user’s choice, either pushes or pops an element in a stack. The elements are shifted towards right so that top always remains at 0th (zeroth) index.

sa 12 cs chapter 10 / PythonCSIP CS IP

# Code def push(stack, x): stack.insert(0, x) # this way top is always at the front def pop(stack): return stack.pop(0) # pops from the front because it is the top l = [4, 5, 6, 7] push(l, 8) # l becomes [8, 4, 5, 6, 7] x = pop(l) print(x) # x is 8

3. Write a program that depending upon user’s choice, either pushes or pops an element in a stack. The elements are shifted towards right so that top always remains at 0th (zeroth) index. Read More »

Post pagination
← Previous 1 … 41 42 43 … 199 Next →
  • We teach following classes
    • Class 12
    • Class 11
    • Class 10
    • Class 9
  • Sumita Arora IP/CS Solutions
  • Jobs/Internship
  • We teach following classes
  • Sumita Arora IP/CS Solutions
  • Jobs/Internship

Copyright © 2025 Pooja Bhatia Classes Hari Nagar | Powered by Pooja Bhatia Classes Hari Nagar.