Question

This will be done using Python in Linux Mint. The program should include a comment block...

This will be done using Python in Linux Mint. The program should include a comment block at the top with your name, the program number, and the name of the course. (Make sure to have the file that does have the extension .py) How to run the file in Linux Mint?  Open a command prompt (e.g. terminal)  Make sure you are in the directory where your file is saved (e.g. type "cd ~/Desktop" if your file is on Desktop)  Type: python3 program_name.py Have the user enter a numeric value? For that number, tell if:

a) The value entered is a whole number (hint: cast to an int) e.g. 4.5 is not a whole number or 3 is a whole number

b) The value is, or is not, a multiple of 9

c) The value is positive, negative, or zero

d) The value is, or is not, within the range of 10 to 99 inclusive

e) The value is, or is not, within the 1000’s, meaning is it a four-digit number which starts with 1.

Then ask for a second value. Using both values, tell:

f) Which of the two values is the smallest, or if they are equal (e.g. “first value is smaller” or “second value is smaller” or “the two values are equal”)

g) If the second value is, or is not, a multiple of the first value h) If the first value is, or is not, a multiple of the second value Each of the points listed above should generate one output statement

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code Snippet :

prin 15 checker.py def whole check(n): if n.is integer(): #checking inti print(n, is a whole number), else: print(n, is no

Output :

xor_d3vil@msi:-/Desktop/Chegg$ py3 checker.py 6.3 6.3 is not a whole number 6.3 is not a multiple of 9 6.3 is positive 6.3 is

Raw Code :

def whole_check(n):
   if n.is_integer(): #checking int
       print(n,'is a whole number')
   else:
       print(n,'is not a whole number')
def multiple_9(n):
   if n%9==0: #checking multiple of 9
       print(n,'is a multiple of 9')
   else:
       print(n,'is not a multiple of 9')
def check_sign(n):
   if n>0: #checking sign
       print(n,'is positive')
   elif n==0: print(n,'is zero')
   else:
       print(n,'is negative')
def check_range(n):
   if n>=10 and n<=99: #checking whether range is btw 10 and 99
       print(n,'is between 10 and 99 inclusive')
   else:
       print(n,'is not between 10 and 99 inclusive')
def check_multiple(n,a):
   if n%a==0: #checking multiple or not
       print(n,'is a multiple of ',a)
   else:
       print(n,'is not a multiple of ',a)
   if a%n==0: #checking multiple or not
       print(a,'is a multiple of ',n)
   else:
       print(a,'is not a multiple of ',n)
def check_four_digit(n):
   if n>=1000 and n<=1999: #checking four digit number within 1000's
       a = int(input('Enter a number : '))
       if n>a: print('second value is smaller')
       elif n==a:
           print('the two values are equal')
       else:
           print('first value is smaller')
       check_multiple(n,a)
n = float(input()) #Taking input
whole_check(n);multiple_9(n);check_sign(n);check_range(n);check_four_digit(n); #calling all functions

Add a comment
Know the answer?
Add Answer to:
This will be done using Python in Linux Mint. The program should include a comment block...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Must be done in python and using linux mint Write a program to create a text...

    Must be done in python and using linux mint Write a program to create a text file which contains a sequence of test scores. Each score will be between 0 and 100 inclusive. There will be one value per line, with no additional text in the file. Stop adding information to the file when the user enters -1 The program will first ask for a file name and then the scores. Use a sentinel of -1 to indicate the user...

  • Please write comments with the program. Python programming!! Part III - write student data In this...

    Please write comments with the program. Python programming!! Part III - write student data In this part the program should create a .csv file and fill it with generated student information. The program should: Ask the user for a name for the .csv file (use your own name for the exercise) Create the .csv file with columns named - ID, first-name, GPA Based on the information received in part I, generate and fill students information in the CSV file Tell...

  • I have synaptic installed already just dont know how set these rules i am using linux...

    I have synaptic installed already just dont know how set these rules i am using linux mint Install the program Synaptic. If Synaptic is already installed in your distro you are lucky. For those of us without a pre-installed Synaptic look around in your desktop for information about how to install program. In most distros it has a name like "Software Center" or something similar. Within the Software Center you will find Synaptic and instructions for installation. Go to the...

  • please put the comment each line, make sure i will have output too. write a program,...

    please put the comment each line, make sure i will have output too. write a program, Summarize (Summarize.java), containing the main() method, that first writes 10,000 random positive double type numbers, to the full accuracy of the number (15/16 decimal places), to a text file named DataValues.txt, one number per line. The program must then close that file, and reopen it for reading. Read back the values from the file and write the following information to a file named Summary.txt:...

  • This is done in Linux terminal. Modify the .bashrc file using command line which would add...

    This is done in Linux terminal. Modify the .bashrc file using command line which would add the following functionality to your shell upon opening a new terminal: 1. Alias called “fc” (short for “folder contents) invoking the command “ls -lah”B. Welcome message “This is demo number 7” C. Variable “semester” being equal to “Winter 2020” and print the value on screen 2. Create any directory of your choice and add it to PATH variable. 3. Show an example of local...

  • . Use what you learned from our First Python Program to write a Python program that...

    . Use what you learned from our First Python Program to write a Python program that will carry out the following tasks. Ask user provide the following information: unit price (for example: 2.5) quantity (for example: 4) Use the following formula to calculate the revenue: revenue = unit price x quantity Print the result in the following format on the console: The revenue is $___. (for example: The revenue is $10.0.) . . Use the following formula to calculate the...

  • Python 3.7 Coding assignment This Program should first tell users that this is a word analysis...

    Python 3.7 Coding assignment This Program should first tell users that this is a word analysis software. For any user-given text file, the program will read, analyze, and write each word with the line numbers where the word is found in an output file. A word may appear in multiple lines. A word shows more than once at a line, the line number will be only recorded one time. Ask a user to enter the name of a text file....

  • Swapping Values in python Summary In this lab, you complete a Python program that swaps values...

    Swapping Values in python Summary In this lab, you complete a Python program that swaps values stored in three variables and determines maximum and minimum values. The Python file provided for this lab contains the necessary input and output statements. You want to end up with the smallest value stored in the variable named first and the largest value stored in the variable named third. You need to write the statements that compare the values and swap them if appropriate....

  • Write a program which implements a dice game. Name your program file 'YourUsernameA105.py, e.g. afer023A1Q5.py. The...

    Write a program which implements a dice game. Name your program file 'YourUsernameA105.py, e.g. afer023A1Q5.py. The aim of the game is to reach a score as close as possible to 100 (but not over 100) in three rounds. Each round consists of throwing five random dice, the user then chooses two of the dice values where the two dice values chosen form a two digit score which is added to the user's current total, e.g., if the user first chooses...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT