Question

In Python: import math from fractions import Fraction kg = (print(int(input("Enter the avg male mass of...

In Python:

import math
from fractions import Fraction
kg = (print(int(input("Enter the avg male mass of your marsupial: "))))

def func1 (kg):
    result = (math.sqrt(math.sqrt(kg))) * math.sqrt(kg)
    return result

def func2 (kg):
    result = (6.3552 * kg) + 1.8751
    return result

print(func1(kg))
print(func2(kg))

The def works for only when an actual number is in place, not when using the user variable input. How do I fix this?

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

import math
kg = int(input("Enter the avg male mass of your marsupial: ")) # You just need to change this line

def func1 (kg):
result = (math.sqrt(math.sqrt(kg))) * math.sqrt(kg)
return result

def func2 (kg):
result = (6.3552 * kg) + 1.8751
return result

print(func1(kg))
print(func2(kg))

Add a comment
Know the answer?
Add Answer to:
In Python: import math from fractions import Fraction kg = (print(int(input("Enter the avg male mass of...
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
  • IN PYTHON ''' Helper func 3: checksum_ISBN Input: a list with 9 single digit number in...

    IN PYTHON ''' Helper func 3: checksum_ISBN Input: a list with 9 single digit number in it (first 9 digit in ISBN) Output: print out: "The correct checksum digit is:__. Now we have a legit ISBN: _____" Hint: just loop through 0-9, test every one with helper func1 to find out the one checksum that forms a legit ISBN with the correct ISBN in lis (10 numbers), call helper func2 to format it correctly. Then print the final result. '''...

  • Intro to Python: Q1: Bonnie is writing a Python program for her math class so she can check her answers quickly. She is...

    Intro to Python: Q1: Bonnie is writing a Python program for her math class so she can check her answers quickly. She is having some difficulties, however, because when she enters values like 3.5 or 2.71 her program throws an error. She has heard of your expertise in Python and asks for your help. What error is being thrown and how can she fix the program to accept values like 3.5 or 2.71? from math import sgrt def distance (coorl,...

  • This problem demonstrates the use of import module. The Python programming language has many strengths, but...

    This problem demonstrates the use of import module. The Python programming language has many strengths, but one of its best is the availability to use many existing modules for various tasks, and you do not need to be an experienced computer programmer to start using these modules. We have given you some incomplete code; note that the very first line of that code contains an import statement as follows: import math This statement enables your program to use a math...

  • Can you please enter this python program code into an IPO Chart? import random def menu():...

    Can you please enter this python program code into an IPO Chart? import random def menu(): print("\n\n1. You guess the number\n2. You type a number and see if the computer can guess it\n3. Exit") while True: #using try-except for the choice will handle the non-numbers #if user enters letters, then except will show the message, Numbers only! try: c=int(input("Enter your choice: ")) if(c>=1 and c<=3): return c else: print("Enter number between 1 and 3 inclusive.") except: #print exception print("Numbers Only!")...

  • This is a python question. from urllib import request import json """ Complete this program that...

    This is a python question. from urllib import request import json """ Complete this program that calculates conversions between US dollars and other currencies. In your main function, start a loop. In the loop, ask the user what currency code they would like to convert to And, how many dollars they want to convert. If you scroll down, you can see an example response with the available 3-letter currency codes. Call the get_exchange_rates() function. This function returns a dictionary with...

  • This is a python question. Start with this program, import json from urllib import request def...

    This is a python question. Start with this program, import json from urllib import request def main(): to_continue = 'Yes' while to_continue == 'yes' or to_continue == 'Yes': currency_code = input("Enter currency code: ").upper() dollars = int(input("Enter number of dollar you want to convert: ")) # calling the exchange_rates function data = get_exchange_rates() if currency_code in data["rates"].keys(): currency = data["rates"][currency_code] # printing the the currency value by multiplying the dollars amount. print("The value is:", str(currency * dollars)) else: print("Error: the...

  • You may import the following library functions in your module: from fractions import gcd from math...

    You may import the following library functions in your module: from fractions import gcd from math import log from math import floor You may also use: • the .bit_length() method to efficiently obtain the bit length of an integer, • the abs() function for computing the absolute value of an integer, • and the // operator for integer division (you should avoid using / because it does not work for very large integers). Implement the following Python functions. These functions...

  • Using python 3.6 How do I incorporate 0 or negative input to raise an error and...

    Using python 3.6 How do I incorporate 0 or negative input to raise an error and let the user try again? like <=0 #loop to check valid input option. while True: try: choice = int(input('Enter choice: ')) if choice>len(header): print("Invalid choice!! Please try again and select value either:",end=" ") for i in range(1,len(header)+1): print(i,end=",") else: break choice = int(input('\nEnter choice: ')) except ValueError as ve:print('Invalid response, You need to select the number choice from the option menu') # Catch your...

  • PYTHON The provided code in the ATM program is incomplete. Complete the run method of the...

    PYTHON The provided code in the ATM program is incomplete. Complete the run method of the ATM class. The program should display a message that the police will be called after a user has had three successive failures. The program should also shut down the bank when this happens. [comment]: <> (The ATM program allows a user an indefinite number of attempts to log in. Fix the program so that it displays a message that the police will be called...

  • Greeting! Kindly help me to solve my finals in PYTHON, I don't have a knowledge in...

    Greeting! Kindly help me to solve my finals in PYTHON, I don't have a knowledge in PYTHON, new student. Please, please, I'm begging, Kindly answers all the questions. I'm hoping to grant my request. Thanks in advanced. 1.) What is the output of the following snippet? l1 = [1,2] for v in range(2): l1.insert(-1,l1[v]) print(l1)        a.) [1, 2, 2, 2]        b.) [1, 1, 1, 2]        c.) [1, 2, 1, 2]        d.) [1,...

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