Python Forum
How to compile following python loop program
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to compile following python loop program
#1
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!
Reply
#2
So, what have you tried? This looks like Homework question, so I will now move it to respective sub-forum.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
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.
Reply
#4
  • 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.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Exclamation How to get program to loop if input date is in the past? xander_thornton45 3 1,780 Oct-11-2024, 10:08 AM
Last Post: Pedroski55
  Using If Statements Instead of While Loop in Simple Game Program new_coder_231013 5 5,786 Dec-14-2021, 12:23 AM
Last Post: supuflounder
  RockPaperScissor program while loop malfunction tonyliang19 3 3,856 Apr-03-2020, 11:09 PM
Last Post: SheeppOSU
  Program that, inside a loop, does multiple things. needs to print in a certain way reidmcleod 1 3,322 Feb-19-2019, 02:35 PM
Last Post: marienbad

Forum Jump:

User Panel Messages

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