Python Forum
How to compile following python loop program - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: How to compile following python loop program (/thread-35374.html)



How to compile following python loop program - reinispl - Oct-26-2021

How to Compile a program that requires the user to enter two integers A and B. The program outputs all numbers between A and B in descending order and their 2nd, 3rd, and 4th degrees/ in power.

Tnx!


RE: How to compile following python loop program - buran - Oct-26-2021

So, what have you tried? This looks like Homework question, so I will now move it to respective sub-forum.


RE: How to compile following python loop program - jefsummers - Oct-26-2021

Also, Python is an interpreted language, so do you really mean compile? Install, change to .exe, for what platform? I bet you just mis-spoke.


RE: How to compile following python loop program - DeaD_EyE - Oct-27-2021

  • ask user for a
  • ask user for b
  • convert the string a and b to an integer
  • for-loop which counts from b to a by -1
  • inside the for loop you calculate the 2nd, 3rd and 4th degree, and then you print the results.

Make two functions.
One to ask the user for a number, and one to do the looping + calculation + output.