Question: Each program must start with a multi-line comment as shown below. For example to write the comments for Assignment 1 question 2, replace x with
Each program must start with a multi-line comment as shown below. For example to write the comments for Assignment 1 question 2, replace x with 1 and y with 2. Replace each occurrence of DentStew and Stew Dent with your name. Replace yyyy/mm/dd with the date you completed the program. # DentStewAxQy.py # # Course: COMP 1012 # Instructor: Ramin Soltanzadeh # Assignment: x Question y # Author: Stew Dent # Version: yyyy/mm/dd # # Purpose: The purpose of the program. # # var1 - the use / meaning of each variable in the program Begin each program with the following statements. from time import ctime print(' --------------------------------------------- ') End each program with the following statements. Print(""" Programmed by Stew Dent Date: %s End of processing.""" % ctime())
The purpose of this question is to get an integer number from input, reverse the order of its digits and print the result in the output. An integer like 625 is entered by user, converted from a string to an integer, and then a new integer, with the digits reversed (1.e. 526) is calculated and printed in the output. Your program should also be able to recognize the number of the digits and do the same procedure regardless of the number of the digits that user has entered. To find the number of digits, you have to divide the entered number by 10 and keep doing this until the result of the integer division is zero. The number of the digits for the entered number should also be printed in the output NOTE: You are not allowed to use logarithm to find the number of the digits of an entered number See below for sample input to and output from the program. Your input and output should match the sample as closely as possible. Enter an integer number: 625 The number has 3 digits and its reverse is: 526 Programmed by Stew Dent. Date: Sat Jan 23 22:30:00 2021 End of processing. Enter an integer number: 371 The number has 3 digits and its reverse is: 173 Programmed by Stew Dent Date: Sat Jan 23 22:31:06 2021 End of processing
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
