Python, given a code in class i just need help with the third bullet point ; using a and n (defined in the second picture of python code) find the first digit for k! for k =1,...,n. you dont have to type in all this code just help me write the code in the first picture where it says: def benford(a):
b = [0 for d in range(1,10)]
#Do everthything in here
return b
Below is the complete code for your benford() function,
it returns the normalised data.
Python, given a code in class i just need help with the third bullet point ; using a and n (defin...
I am having trouble with my Python code in this dictionary and
pickle program. Here is my code but it is not running as i am
receiving synthax error on the second line.
class Student:
def__init__(self,id,name,midterm,final):
self.id=id
self.name=name
self.midterm=midterm
self.final=final
def calculate_grade(self):
self.avg=(self.midterm+self.final)/2
if self.avg>=60 and self.avg<=80:
self.g='A'
elif self.avg>80 and self.avg<=100:
self.g='A+'
elif self.avg<60 and self.avg>=40:
self.g='B'
else:
self.g='C'
def getdata(self):
return self.id,self.name.self.midterm,self.final,self.g
CIT101 = {}
CIT101["123"] = Student("123", "smith, john", 78, 86)
CIT101["124"] = Student("124", "tom, alter", 50,...
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...
9p
This is for Python I need help.
Pet #pet.py mName mAge class Pet: + __init__(name, age) + getName + getAge0 def init (self, name, age): self.mName = name self.mAge = age Dog Cat def getName(self): return self.mName mSize mColor + __init__(name, age,size) + getSize() + momCommento + getDog Years() +_init__(name, age,color) + getColor + pretty Factor + getCatYears def getAge(self): return self.mAge #dog.py import pet #cat.py import pet class Dog (pet. Pet): class Cat (pet. Pet): def init (self,...
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,...
attention!!!!!!! I need python method!!!!!!!!!
the part which need to edit is below: i need python
one!!!!!!!!!
the part below is interface for the range search tree which
don’t need to modify it.
Week 3: Working with a BST TODO: Implement a Binary Search Tree (Class Name: RangesizeTree) Choose one language fromJava or Python. Iin both languages,there is an empty main function in the Range Size Tree file. The main function is not tested, however, it is provided for you...
Hello I need help with python programming here is my code # Trivia Challenge # Trivia game that reads a plain text file import sys def open_file(file_name, mode): """Open a file.""" try: the_file = open(file_name, mode) except IOError as e: print("Unable to open the file", file_name, "Ending program.\n", e) input("\n\nPress the enter key to exit.") sys.exit() else: return the_file def next_line(the_file): """Return next line from the trivia file, formatted.""" line = the_file.readline() line = line.replace("/", "\n") return line def next_block(the_file):...
Python Programming (Just need the
Code)
Index.py
#Python 3.0
import re
import os
import collections
import time
#import other modules as needed
class index:
def __init__(self,path):
def buildIndex(self):
#function to read documents from
collection, tokenize and build the index with tokens
# implement additional
functionality to support methods 1 - 4
#use unique document integer
IDs
def exact_query(self, query_terms, k):
#function for exact top K retrieval (method 1)
#Returns...
I need help with this question. I need a supporting
paragraph.
Following are results from three hypothetical corporate tax returns. Each purports to be a list of expenditures, in dollars, that the corporation is claiming as deductions. Two of the three are genuine, and one is a fraud. Which one is the fraud? Write at least 6 complete sentences explaining why you think your chosen return is a fraud. 17 ORE 80.535 3.037 132.056 59.727 38.154 137.648 79.386 203.374 11.967...
Using python
Here is the code
import turtle
def draw_triangle(vertex, length, k):
'''
Draw a triangle at depth k given the bottom vertex.
vertex: a tuple (x,y) that gives the coordinates of the bottom
vertex.
When k=0, vertex is the left bottom vertex for the outside
triangle.
length: the length of the original outside triangle (the
biggest one).
k: the depth of the input triangle.
As k increases by 1, the triangles shrink to a smaller
size.
When k=0, the...