Question

CAN SOMEONE PLEASE EXPLAN FO ME WHATS WRONG WITH MY CODE WHEN EVEN I RUN IT...

CAN SOMEONE PLEASE EXPLAN FO ME WHATS WRONG WITH MY CODE WHEN EVEN I RUN IT IT GIVE ME THIS MASSAGE IM USING python BTW

Traceback (most recent call last):                                                                                                                                              

  File "../resource/asnlib/public/RUN.py", line 20, in <module>                                                                                                                 

    exec(source_code, dict())                                                                                                                                                   

  File "<string>", line 60, in <module>                                                                                                                                         

NameError: name 'total_rough_sod' is not defined )

from math import pi

length = float(input('Enter Course Length:'))
width = float(input('Enter Course Width:'))


def calculate_smooth_sod(width):
grean_area_raduis= (width/2)/2
total_smooth_sod=2*pi*(grean_area_raduis**2)
return total_smooth_sod

def calculate_sand_trap_area(width):
sand_trap_radius=(width/3)/2
sand_trap_area=pi*(sand_trap_radius**2)
return sand_trap_area

def calculate_rough_sod(length, width, total_smooth_sod, sand_trap_area):
total_area= length*width
total_rough_sod= total_area-total_smooth_sod-sand_trap_area
return total_rough_sod

def calculate_bricks(width):
length_of_brick_wall= pi*(width*3/6)
number_of_bricks= length_of_brick_wall*3
return number_of_bricks

def calculate_sand(width):
width_in_ft= width*3
sand_trap_radius= width_in_ft/6
sand_trap_area=pi*(sand_trap_radius**2)
total_sand=(sand_trap_area*100)/2000
return total_sand

def calculate_bushes(length, width):
perimeter=2*(length+width)
total_bushes=perimeter-2
return total_bushes

def calculate_total_time(total_rough_sod, total_smooth_sod):
total_time=(total_rough_sod*0.5)+(total_smooth_sod)
return total_time

60-print("Total square yards of rough sod: " + str(total_rough_sod))
61-print("Total square yards of smooth sod: " + str(total_smooth_sod))
62-print("Tons of sand: " + str(total_sand))
63-print("Number of retaining wall bricks: " + str(number_of_bricks))
64-print("Number of bushes: " + str(total_bushes))
65-print("Total mowing time (mins): " + str(total_time))

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#variables declared inside functions are not accessible outside. Also, you never called the created functions on the values inputted
from math import pi

def calculate_smooth_sod(width):
    grean_area_raduis= (width/2)/2
    total_smooth_sod=2*pi*(grean_area_raduis**2)
    return total_smooth_sod

def calculate_sand_trap_area(width):
    sand_trap_radius=(width/3)/2
    sand_trap_area=pi*(sand_trap_radius**2)
    return sand_trap_area

def calculate_rough_sod(length, width, total_smooth_sod, sand_trap_area):
    total_area= length*width
    total_rough_sod= total_area-total_smooth_sod-sand_trap_area
    return total_rough_sod

def calculate_bricks(width):
    length_of_brick_wall= pi*(width*3/6)
    number_of_bricks= length_of_brick_wall*3
    return number_of_bricks

def calculate_sand(width):
    width_in_ft= width*3
    sand_trap_radius= width_in_ft/6
    sand_trap_area=pi*(sand_trap_radius**2)
    total_sand=(sand_trap_area*100)/2000
    return total_sand

def calculate_bushes(length, width):
    perimeter=2*(length+width)
    total_bushes=perimeter-2
    return total_bushes

def calculate_total_time(total_rough_sod, total_smooth_sod):
    total_time=(total_rough_sod*0.5)+(total_smooth_sod)
    return total_time

length = float(input('Enter Course Length: '))
width = float(input('Enter Course Width: '))

print("Total square yards of rough sod: " + str (calculate_rough_sod(length,width,calculate_smooth_sod(width),calculate_sand_trap_area(width))))
print("Total square yards of smooth sod: " + str(calculate_smooth_sod(width)))
print("Tons of sand: " + str(calculate_sand(width)))
print("Number of retaining wall bricks: " + str(calculate_bricks(width)))
print("Number of bushes: " + str(calculate_bushes(length,width)))
print("Total mowing time (mins): " + str(calculate_total_time(calculate_rough_sod(length,width,calculate_smooth_sod(width),calculate_sand_trap_area(width)),calculate_smooth_sod(width))))

Add a comment
Know the answer?
Add Answer to:
CAN SOMEONE PLEASE EXPLAN FO ME WHATS WRONG WITH MY CODE WHEN EVEN I RUN IT...
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
  • Python only please, thanks in advance. Type up the GeometricObject class (code given on the back...

    Python only please, thanks in advance. Type up the GeometricObject class (code given on the back of the paper). Name this file GeometricObjectClass and store it in the folder you made (xxlab14) 1. Design a class named Rectangle as a subclass of the GeometricObject class. Name the file RectangleClass and place it in the folder. 2. The Rectangle class contains Two float data fields named length and width A constructor that creates a rectangle with the specified fields with default...

  • Type up the GeometricObject class (code given on the back of the paper). Name this file Geometric...

    Python only please, thanks in advance. Type up the GeometricObject class (code given on the back of the paper). Name this file GeometricObjectClass and store it in the folder you made (xxlab14) 1. Design a class named Rectangle as a subclass of the GeometricObject class. Name the file RectangleClass and place it in the folder. 2. The Rectangle class contains Two float data fields named length and width A constructor that creates a rectangle with the specified fields with default...

  • I want to have a code that can pick whichever two planets in the solar system and find the distance of them no matter where in their orbit they are, but I keep getting errors. Can someone please help...

    I want to have a code that can pick whichever two planets in the solar system and find the distance of them no matter where in their orbit they are, but I keep getting errors. Can someone please help me fix it? f rom scipy import exp, pi, absolute, linspace import matplotlib. Ryplot as plt planet-I input ('Which planet do you want to pick for planet 1?") planet_2 input ('which planet do you want to pick for planet 27') distance...

  • Can someone help me to see what" wrong with my code?

    def cleanedup(s):  alphabet = 'abcdefghijklmnopqrstuvwxyz#'  cleantext = ''  for character in s.lower():    if character in alphabet:      cleantext += character    else:      cleantext += ' '  return cleantextlinecount=0maxlength=0with open('elon-musk.txt') as text:  for line in text:    linecount+=1    length=len(line.split())  if length>maxlength:     maxline=line     maxlength=length  print('number of tweets:',linecount)  print('Tweet with max number of words:', maxline)        tweets={}with open('elon-musk.txt') as text:    for line in text:        for word in cleanedup(line).split():       ...

  • 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...

  • can someone please help me write a python code for this urgently, asap Question: Write a Python function, minmp,...

    can someone please help me write a python code for this urgently, asap Question: Write a Python function, minmp, that is passed a file name and a metal alloy's formula unit structure*". The file will contain metal elements and their properties. The function will return a tuple of the element from the formula with the lowest melting point and that melting point Write a second function, molform, that will be called by the first function, to take the metal alloy's...

  • can someone please tell me where did I do wrong and how I can fix this...

    can someone please tell me where did I do wrong and how I can fix this TU. . IVIL main.py Load default template... 1 # Read a list of strings from the user' 3 def square(x): return x*x nmin on input_string = input() 7 numbers= 11 8 for i in (str(input_string): numbers.append(i*2) 10 # Use list comprehension to cast them to ints 11 numbers = [int(i) for i in input_string.split()] 12 result = list (map(lambda x: x*x, numbers)) 13 for...

  • PYTHON. Continues off another code. I don't understand this. Someone please help! Comment the lines please...

    PYTHON. Continues off another code. I don't understand this. Someone please help! Comment the lines please so I can understand LinkedList ADT: class myLinkedList:     def __init__(self):         self.__head = None         self.__tail = None         self.__size = 0     def insert(self, i, data):         if self.isEmpty():             self.__head = listNode(data)             self.__tail = self.__head         elif i <= 0:             self.__head = listNode(data, self.__head)         elif i >= self.__size:             self.__tail.setNext(listNode(data))             self.__tail = self.__tail.getNext()         else:             current = self.__getIthNode(i - 1)             current.setNext(listNode(data,...

  • PYTHON. Continues off another code(other code is below). I don't understand this. Someone please help! Comment...

    PYTHON. Continues off another code(other code is below). I don't understand this. Someone please help! Comment the lines please so I can understand. There are short and med files lengths for each the list of names/ids and then search id file. These are the input files: https://codeshare.io/aVQd46 https://codeshare.io/5M3XnR https://codeshare.io/2W684E https://codeshare.io/5RJwZ4 LinkedList ADT to store student records(code is below). Using LinkedList ADT instead of the Python List. You will need to use the Student ADT(code is below) Imports the Student class...

  • For my computer class I have to create a program that deals with making and searching...

    For my computer class I have to create a program that deals with making and searching tweets. I am done with the program but keep getting the error below when I try the first option in the shell. Can someone please explain this error and show me how to fix it in my code below? Thanks! twitter.py - C:/Users/Owner/AppData/Local/Programs/Python/Python38/twitter.py (3.8.3) File Edit Format Run Options Window Help import pickle as pk from Tweet import Tweet import os def show menu():...

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