text
stringlengths
226
34.5k
Relative import correction without sys or os Question: I've read almost all of the solutions for fixing relative imports and none of them seem to work. Here's my current structure: structures \ containers \ queue.py \ trees \ binaryTree.py I want to import the queue in to my bin...
Calling a function in a class of another program - Python Question: As the title says, how do you call a function in a class of another program? Class.py class Object: def __init__(self, mood): self.__mood = mood def set_mood(self, mood): self.__mood = mood ...
Scrapy Flight Search Question: I'm trying to use Scrapy in Python to run a flight search on some flights and then export it to a csv. This is just for fun as I learn more about Scrapy. Here is what I have from scrapy.item import Item, Field from scrapy.http import FormRequest from scrapy.spid...
Code not returning response to command Question: Quick question: I'm using the Speech Python Module for voice recognition. Here's the code I have so far, import speech import time def callback(phrase, listener): if listener == "hello": print "Hello sir." ...
Restarting a thread in Python Question: I'm trying to make threaded flight software for a project in Python 3.4, in which I need threads to restart themselves in case an I/O error occurs during a sensor read or another fluke crash like that. Therefore I am working on making a watchdog to check if threads have died and ...
Histogram with independent line matplotlib Question: Working with matplotlib (1.3.1-2), python 2.7. I create a a stacked histogram with timely distribution on the x-Axis the following: import matplotlib.pyplot as plt import matplotlib.dates as mdates #the dates for plotting (numpy arra...
how to create dynamic configuration file using python Question: I have a python script which is controlled by a config file called **system.config** .the structure of config file is like bellow with some default values. [company] companyname: XYZ [profile] name: ABC joining: 1/1/2014...
How to always use the same instance of a class in Python? Question: I am using the following solution to maintain a list of classes instances: <http://stackoverflow.com/a/12102163> Now I want to use that list to make sure that there is always only one instance of the class. Renewed initializations of the class should ...
Python import vs direct execution Question: #conf.py def init(): global mylist mylist=[] #change.py import conf def change(): if __name__ == "__main__": print('Direct') conf.mylist.append('Directly executed') pr...
Python - Zipping a directory Question: This code currently creates a zip file on the same destination the Python script is executed, and attempts to populate the zip with the contents on "Documents and Settings\Owner". However, it keeps trying to copy across ntuser.dat and NTUSER.dat which gives me an error: `[Errno 13...
How to write long Pandas aggregations well? Question: **TL;DR** How do you write long aggregations involving many operations like `groupby()`, `unstack()` or `apply()` well? **Example** Say you have a `DataFrame()` with `n_sales = 1000` ticket sales for `n_events = 10` different events, like import pa...
Python, Jinja2 nl2br and security Question: I'm using the [snippet from Jinja2](http://jinja.pocoo.org/docs/dev/api/#custom-filters) for showing multiline texts in html and I'm facing an issue : If the user enters "Hello\nMy name is Jon" the `nl2br` tag will render it as "Hello<br /...
pkg_resources.resource_stream fails on python3 Question: I am trying to load a resource which is present in my project using `pkg_resources` but it just throws me an exception saying that it quote **"Can't perform this operation for loaders without 'get_data()'"**. I am not sure if I am doing something wrong here, or i...
Healpy pix2ang: Convert from HEALPix index to RA,Dec or glong,glat Question: I am new to HEALPix and fairly new to Python as well. I try to use healpy to convert a HEALPix index to RA,Dec. I get that I have to use pix2ang, but cannot figure how to convert the output theta,phi into RA,Dec... I tried this: ...
Replace a tag with another tag in BeautifulSoup Question: I'm attempting to find a tag within an XML document, and replace it entirely with a new tag. I've got what I think should work below: para = monograph.find('para', text='Some text.') newpara = '<para>Some <emph type="bold">new</emph> text.</pa...
Get grid points of a specific plot in python Question: I have plotted a map using matplotlib. I want the coordinates of all grid points within the map and neglect all the grid points outside the map. Is there any method which can be used directly in this? Intertools is giving all the grid points but i want only the poi...
python unicode replace MemoryError Question: i want replace unicode character to a file with python this is my code : with codecs.open('/etc/bluetooth/main.conf', "r", "utf8") as fi: mainconf=fi.read() forrep = ''.decode('utf8') for line in mainconf.splitlines(): ...
collective.localfunctions prevents plone from starting Question: Plone 4.3.3 I am trying to get some extra python modules available to my plone scripts. 'Net search led me to collective.localfunctions, which supposedly demonstrates how to lighten up restricted python. I installed per the instructions: g...
Type Error Python Question: I am currently working on a game and I tried to make an image move and I keep getting this error right here TypeError: unbound method put_here() must be called with create_entity instance as first argument (got int instance instead) Here is the code for the PlayerEntity....
Python: ContextManager-like for function alias Question: ContextManager is really useful and it's also make our code more readable, but it seems it only works if the given function is meant to be a context manager, otherwise it will fail (no `__exit__` or something else). I' wondering if we can use any function includi...
java's e.printStackTrace equivalent in haskell Question: I am trying out haskell's kafka library from git and got this [error](https://github.com/tcrayford/hafka/issues/2). To debug this error, i like to print stacktrace at the error line. In python world, it is just, import traceback; print traceback.p...
Python 2.7: Multiprocessing: How to not block whilst using a queue for communication Question: I am using a Queue for communicating between processes and also an event flag to indicate whether or not the parent process wants to exit however the Queue in child process is in a blocked state, waiting for more input. I ca...
Skip a specified number of columns with numpy.genfromtxt() python 3.4 error Question: import os import numpy as np import matplotlib.pyplot as plt # Open a file path = "input/" filelist = list(filter(lambda s: s.endswith(".asc"), os.listdir(path))) firstImage = np.genfromtxt (" "....
How can I import a Python class that is in two directories above and one below? Question: How can I import a CustomerHelper class inside `customer_helper.py` from `customer_helper_test.py`? It's possible? I used `from ..helpers..tests..app.helpers.customer_helper import CustomerHelper` but it's invalid syntax. Here is...
Having trouble understanding directory navigation with os.walk Question: I'm relatively new to python and I'm trying my hand at a weekend project. I want to navigate through my music directories and get the artist name of each music file and export that to a csv so that I can upgrade my music collection (a lot of it is...
Correct way to make python module smaller by delegating Question: I'm trying to reduce clutter in my project's models.py and I decide to move out "utility" methods of some models. The idea was to create a bunch of utility modules with classes and functions which will be used by model classes, but since there is no sig...
Singpath Python Error. "Your code took too long to return." Question: I was playing around with the _Singpath_ Python practice questions. And came across a simple question which asks the following: Given an input of a list of numbers and a high number, return the number of multiples of each of ...
Python Assign Value to New Column If Contains() Is True Question: How can I use the str.contains() method to check a column if it contains specific strings and assign a value if true in a different column? Essentially, I'm trying to mimic a CASE WHEN LIKE THEN syntax in SQL but in pandas. Really new to python and panda...
Getting rid of SettingWithCopyWarning in Python pandas Question: I am loading a bunch of csvs and processing certain columns if they exist, after loading the csv with pandas data = pd.read_csv('Test.csv', encoding = "ISO-8859-1", index_col=0) this dataframe will be used in the example ...
Passing model class to function changes behavior Question: The first set of python code properly imports an entire CSV file. However, if I try to pass the model ZipMHA as a parameter, it only imports the first line of the CSV file. Can anybody explain this change in behavior when passing the model into the function? ...
Python: Copy two dependent lists together with their dependence Question: I am stuck with some problem which I guess is not very difficult, but I could not find any answer to it. I have two lists of objects, each of them containing lists of objects in the other. I would like to copy them both to do come tests and eval...
Pygame2exe not executing my game Question: I made a game called "Fish Food" with Python 2.7.6 When executing pygame2exe: running py2exe c:\python27\lib\distutils\dist.py:267: UserWarning: Unknown distribution option: 'dist_dir' warnings.warn(msg) That returns error: bundle-files 1 not ...
Calling a function in another function causing error due to arguments in parantheses Question: As it happens I am just getting into programming with Python and I was about to program a little rock-paper-scissors game. Unfortunately when I'm trying to run my script, I am receiving the following error: fi...
How to run one-off python script on Heroku Question: I have a Django app up and running on Heroku. I want to run a simple script called import.py, which imports a CSV file into my models. It works great on my local computer. When I try to run the script on Heroku using this commmand: heroku run python ma...
moving mutiple files from one folder to another using python Question: I have a “.txt ”file which consists of various filenames and I want to search each filename in a source_folder where these files are actually kept and I want to move the matching files to a specific folder. Source_folder contain files within multipl...
connect two raspberry pi via ethernet cable Question: I am using python to connect two raspberry pi via serial port. one pi will send data to another pi. and another pi will do some specfic task depending on received data. can i use ethernet port for this function? Is there any function similar to serial.read() and ser...
how use server-celery with flask Question: I installed celery-server 3.0.0 to flask and then I started the server, but when I used the server to run a python code backgroud I find this error. > ~/Bureau$ sudo python exme.py > Traceback (most recent call last): > File "exme.py", line 2, in > from celery import...
how can i get translate values in maya python api? Question: Actually i'am new to api and am trying to get the translation values(x,y,z) but the problem is i cant get when i specify only "translate" instead of "translateX", "translateY", "translateZ" in every separate line. is there any way to get what i actually want?...
FuncAnimation Plot hangs when length of list increases Question: For my college project I am developing a traffic generation script in python. This traffic generation script makes use to multiprocessing module to generate large amount of http traffic in concurrent fashion. My scripts are working fine and now I am tryin...
OpenERP 6, Aptana - debugger doesn't stop at breakpoint in QR Bar Code Label code Question: I am trying to debug code for QR Bar Code Labels in OpenERP 6 using Aptana Studio 3. I put a breakpoint in "pyqr" module, file "myfile.py", function "generate_image()", as per attached picture: ![enter image description here](h...
Drop observations from the data frame in python Question: How to delete observation from data frame in python. For example, I have data frame with variables a, b, c in it, and I vat to delete observation if variable a is missing, or variable c is equal to zero. Answer: You could build a boolean mask using `isnull`: ...
GMAIL API doesn't accept most queries (GAE Python) Question: I'm trying to fetch all sent messages for the last 3 months, using a Google App Engine app on Python. For some reason though it doesn't accept most of the queries that I enter. It returns results for a simple string, but if I enter something like "after:2015/...
Python typeError: can't multiply sequence by non-int of type 'float' Question: I have this code a = [0.0, 1.1, 2.2] b = a * 2.0 and that is where I get the error typeError: can't multiply sequence by non-int of type 'float' what I want it to `return` is b = [...
python pandas : how to control the constraints and indices automatically created by to_sql? Question: I am using pandas 0.16 and sqlalchemy to export data to a Microsft SQL Server 2014 database. The dataframe to_sql method automatically creates certain constraints on the table, e.g. it creates a constraint that a boole...
Adding in-between column in csv Python Question: I work with csv files and it seems python provides a lot of flexibility for handling csv files. I found several questions linked to my issue, but I cannot figure out how to combine the solutions effectively... My starting point CSV file looks like this (note there is o...
cannot cast array data when a saved classifier is called Question: I have created a classifier using <https://gist.github.com/zacstewart/5978000> example. To train the classifier I am using following code import os import numpy NEWLINE = '\n' SKIP_FILES = set(['cmds']) def read_...
Basic Docopt Example does not work Question: So, I'm trying to run `odd_even_example.py` from the [docopt examples git repo](https://github.com/docopt/docopt/blob/master/examples/odd_even_example.py). No matter what I try to do, or change, the example won't work as expected. When I: python odd_even_exa...
Convert VTK to raster image (Ruby or Python) Question: I have the results of a simulation on an unstructured 2D mesh. I usually export the results in VTK and visualize them with Paraview. This is what results look like. ![Unstructured grid results](http://i.stack.imgur.com/xBLhU.png) I would like to obtain a raster i...
XML Prettifying from file in Python Question: I have an xml file which looks like the example below. Many texts contain space as the start character, or have `\n` (newline) at the beginning, or other crazy stuff. I'm working with `xml.etree.ElementTree`, and it is good to parse from this file. But I want more! :) I t...
Evaluating K means clustering using python Question: I have a data set slightly similar like this: ![enter image description here](http://i.stack.imgur.com/ss0GM.png) I have performed **K means clustering** using this code: from scipy.cluster.vq import kmeans, vq data=np.matrix(dataAll.ix[:,:-1]) ...
win 8.1 cygwin - pip is installing into windows python directory? Question: I have recently just started the foray into running cygwin on windows. Attempting to setup a development environment, and noticing some oddities. so for example, I have installed virtualenvwrapper but when i open a new cygwin terminal i get (a...
How to call a function only Once in Python Question: here I want to call web service function only once throughout the program. how to accomplish this anybody suggest me import sys,os def web_service(macid): # do something if "__name__" = "__main__" : web_service(m...
wxpython: adding rows to wxgrid dynamically does not fit to panel Question: I have a wxgrid inside a resizable scrollable panel. I dynamically add/hide/show rows in wxgrid. When I try to add/show more rows in wxgrid, it does not fit to the available space in panel but instead occupies a small area it had been occupying...
Installing Sci Kit Learn on Mac OSX Question: On my OSX laptop I have installed Sci Kit Learn by copying and pasting this command `pip install -U numpy scipy scikit-learn` to terminal as instructed on [this](http://scikit-learn.org/stable/install.html#mac-osx) page. This is the result I get when I run the command on t...
python get substring from regex Question: I want to extract a substring from a string, which is conform to a certain regex. The regex is: `(\[\s*(\d)+ byte(s)?\s*\](\s*|\d|[A-F]|[a-f])+)` Which effectively means that all of these strings get accepted: [4 bytes] 66 74 79 70 33 67 70 35 [ 4 bytes ] 6...
python how to use mailchimp to send email Question: I have been reading a lot on internet to know how can i use python to send emails using mailchimp api it seems that the website is so complected and doesn't have any example, please could you guide me to any example to use pytyon ### what I tried i installed the l...
Erase some lines in json file Question: **_i have a json file:_** ![json file](http://i.stack.imgur.com/H4exJ.png) i want to erase some line in this file **_like this:_** ![json file modify](http://i.stack.imgur.com/WYE6C.png) how can i do this with a python script ..? Answer: import json data = json.loa...
Image convolution at specific points Question: Is there a way in scipy (or other similar library) to get the convolution of an image with a given kernel only at some desired points? I'm looking for something like: ndimage.convolve(image, kernel, mask=mask) Where `mask` contains `True` (or `1`) whe...
Python 2.7 TypeError: 'file' object has no attribute '__getitem__' Question: not sure why my statement is giving me this error. I am trying to open a file that the user enters the path. import csv f = open(raw_input('Enter file path: '),'r')[1:-1] Answer: This should be enough to open the...
PyDev: Can't compile after accidentally naming file after Python io.py Question: So I without thinking stupidly named a file io.py in my working directory. When I tried to compile I got a traceback error. Having realised what I'd done I renamed my file and updated references to it but I still get the following error: ...
Python Sqlite3 Database Error Question: I am trying to run a program to put prices into the database but when I try to write to the database I get an error. I'm using Python3.4 and I have sqlite version 3.7.14.1 import sqlite3 con = sqlite3.connect('/../../stocks.db') cur = con.cursor() cur.e...
Scrapy reverses order of arguments in url Python Question: I'm running a scraper to crawl from <http://www.johnlscott.com/agent- search.aspx> to the office rosters. The office roster addresses look like this: [http://www.johnlscott.com/agent- search.aspx?p=agentResults.asp&OfficeID=8627](http://www.johnlscott.com/agen...
How to workaround IronPython Compile() Issue? Question: I'm trying to run the following in my C#/IronPython: import re Message = re.sub(r"^EVN\|A\d+", "EVN|A08", Message, flags=MULTILINE) This works fine on real python at the command prompt. However, once I put it into IronPython I get an error...
Create PySpark Profile for IPython Question: I follow this link <http://ramhiser.com/2015/02/01/configuring-ipython- notebook-support-for-pyspark/> in order to create PySpark Profile for IPython. 00-pyspark-setup.py # Configure the necessary Spark environment import os import sys spa...
Python - Printing on Same Line Question: I am very new and attempting to learn how to scrape tables. I have the following code, but can not get the two variables to print on the same line; they print on separate lines. What am I missing? from lxml import html from bs4 import BeautifulSoup import ...
Using Python 2.7 and matplotlib, how do I create a 2D Line using two different styles? Question: Working on a personal project that draws two lines, each dashed (ls='--') for the first two x-axis markings, then it is a solid line...thinking about writing a tutorial since I've found no information on this. Anyhow, the t...
unable to submit spark python script Question: I'm using the following script to submit a python script #!/usr/bin/python from pyspark.mllib.classification import LogisticRegressionWithSGD from pyspark.mllib.regression import LabeledPoint from numpy import array from pyspark import S...
pandas dataframe to oracle - NotImplementedError Question: I am trying to insert a pandas dataframe in to oracle table with the following code: tabl.to_sql('RESULT', cnxn, flavor='oracle', if_exists='replace'); however, I am running in to the following error: Traceback (most recent ...
Best way to share global variables between files in Python Question: I was wondering what the best way is to use global variables in a multi-script python project. I've seen this question: [Using global variables between files in Python?](http://stackoverflow.com/questions/13034496/using-global- variables-between-files...
Python Webdriver my script won't find the button inside the iFrame Question: I am trying to verify if a button is present on a webpage after I have successfully logged in. I am using Webdriver with Python. The button is in an iFrame. This is my first webdriver python program using the a page object model framework. Not...
"list_or_dict must be a list or a dict" when using append in openpyxl package of Python Question: Based on this tutorial : [LINK](https://openpyxl.readthedocs.org/en/latest/usage.html) we have this structure: from openpyxl import Workbook from openpyxl.compat import range wb = Workbook() ...
Python command in python script from another python script Question: I read already this [What is the best way to call a python script from another python script?](http://stackoverflow.com/questions/1186789/what-is-the-best- way-to-call-a-python-script-from-another-python-script) In my case I don't want to call anothe...
Python scapy show ip of the ping (echo) requests Question: I want to grab and print the source address of the ping requests. I have the following script: pkt = sniff(filter="icmp", timeout =15, count = 15) if pkt[ICMP].type == '8': print pkt[IP].src When a packet arrives script crashes ...
django on jython using django-jython Question: **I would appreciate it if you read my poor English** **I use :** > windows > > Jython 2.7rc2 > > jdk-8u45 > > django 1.8 > > django-jython 1.7.0b2 I try `jython startproject mysite`, and succeed then I try `jython manage.py runserver 8080` and fail Detail: In **sett...
How to create a histogram of 2D arrays in ipython Question: I have use the random number generator create a 1000*1000 2d arrays. How can i create a histogram of those 2D arrays? s1=np.random.rand(1000,1000) Answer: Install and use `matplotlib`. Your code will look something like this: ...
Integration in python Question: The code I have written to integrate is giving wrong results.I get the c_0,c_1,...c_4 to be zeros! What am I doing wrong? I am using simply 0.7.6 on a mac. from numpy import * from matplotlib.pyplot import * from sympy import * x = Symbol('x') f = 1.0*sin(n...
String filtering commas and numbers Question: I want to filter a string in Python, to get only commas `,` and numbers `[0-9]`. import re x="$HGHG54646JHGJH,54546654" m=re.sub("[^0-9]","",x) print(m) The result is: 5464654546654 instead of: 54646,54546...
App Engine Python - Sort db then put() index Question: In my app, users earn a score and their details get stored in the datastore. When the user logs in, I want to show their rank among all users(basically how far away from the top score they are). So my solution was to sort the users' profiles in descending order the...
tor name not recognized in stem Question: I am trying to follow the "to russia with love" tutorial (<https://stem.torproject.org/tutorials/to_russia_with_love.html>) but I am getting this error: [1mStarting Tor: [0m Traceback (most recent call last): File "C:\Users\gatsu\My Documents\LiClip...
Python script just printing out blank page Question: I am using xampp and I am able to run simple python script on it so xampp is setup fine for python. I am trying to use pillow. I have installed anaconda and did following in terminal conda install pillow If I run test.py below in terminal, it w...
Pandas file structure not supported error Question: I get a `NotImplementedError: file structure not yet supported`when I run the code below on this [file](https://www.dropbox.com/s/nh117yurq6rk2g7/300113R1.DNC?dl=0) import constants, pandas, pdb from datetime import datetime, timedelta df =...
Why use re.match(), when re.search() can do the same thing? Question: From the documentation, it's very clear that: * `match()` -> apply pattern match at the beginning of the string * `search()` -> search through the string and return first match And `search` with `'^'` and without `re.M` flag would work the same...
pandas area plot interpolation / step style Question: Is there a way to disable the interpolation in the pandas area plot? I would like to get a "step-style" area plot. E.g. in the normal line plot it is possible to specify: import pandas as pd df = pd.DataFrame({'x':range(10)}) df.plot(drawstyle...
Python CSV Output Blank Cells Question: I am trying to write the exact shell output of my python code into a csv file (including the blank fields). My Python output looks like this. I have tried to get my head around but for some reason, I am getting output that looks like this. contractNN develop NN...
swampy.TurtleWorld not working in python 3.4 Question: I m currently learning python using the ThinkPython book, am using python 3.4 and the Anaconda IDE. Part of what I need to continue is to install a module called swampy. I installed it using pip, which worked very well. Importing the module worked too together with...
Python Pyserial Windows No Port Found Question: I have just tried to connect to usb mobile to send sms through it using AT commands. But when i use pyserial to connect to it in a windows os, i get error could not open port, the file specified cannot be found. >>> import serial >>> ser = serial.Serial...
What are python classes? Question: I'm trying to learn programming and came across this in my core app. from django.shortcuts import render from django.views.generic import TemplateView # Create your views here. class SplashView(TemplateView): template_name = "index.html" W...
Python -Why cannot change the value in the C callback function? Question: I try to using python ctype to call C library (.so) , and this C library have callback function. C source code: * * * int showHelloword(int *result) { *result = 1025; return 55; } void BSP_SHOW(int ...
Why Numpy.array is slower than build-in list for fetching sub list Question: I'm going to improve the performance of my code snippet which will frequently getting sub-array recursively. So I used numpy.array instead of build-in list. Because, as I know, when fetching the sub-array, numpy.array don't copy the orginal l...
unix command execution with password via python Question: I am trying to connect to mysql in unix from a python script. I provided the password to connect to mysql in the script itself but terminal still prompts for the password. This is what i have till now: import os from subprocess import Popen, P...
Why only 1024 bytes are read in socketserver example Question: I am reading through the documentation examples for python socketserver at <https://docs.python.org/2/library/socketserver.html> Why is the size specified as 1024 in the line `self.request.recv(1024)` inside handle method. What happens if the data sent by ...
Is there a Python equivalent to the mahalanobis() function in R? If not, how can I implement it? Question: I have the following code in R that calculates the mahalanobis distance on the Iris dataset and returns a numeric vector with 150 values, one for every observation in the dataset. x=read.csv("Iris D...
Fill pygame font with custom pattern Question: I'm currently working on a (first) project in Python/Pygame and I'm trying to display text with a pattern overlay. The pattern consists vertical lines (1 pixel width), 2 alternating colors . I'm creating this pattern using pygame.draw.line(), and I can create rectangles w...
Python: Slicing a String based on Indicies and character Question: I am essentially making a log file parsing program in Python. The issues I am having is when I am trying to extract out a variable length thing, such as an IP address. FILE = importFile.readlines() holderString = '' cleanUp = ...
How to dynamically import variables after executing python script from within another script Question: I want to extract a variable named `value` that is set in a second, arbitrarily chosen, python script. The process works when do it manually in pyhton's interactive mode, but when I run the main script from the comma...
TypeError: unsupported operand type(s) for &: 'float' and 'float', but I have no & Question: Here is part of my code: import numpy as np import pyfits from astropy.io import ascii def create_randoms(min_z,max_z,min_mass): Do some calculations and use it to ...
Why am I getting this error? HTTP Error 407: Proxy Authentication Required Question: I am using the following code found on post, [How to specify an authenticated proxy for a python http connection?](http://stackoverflow.com/questions/34079/how-to-specify-an- authenticated-proxy-for-a-python-http-connection/3942980#394...
Django/Apache setup giving me a 'module not found' error Question: So I have this AngularJS/Django/Apache project I was thrown on once a past employee left. So far it's been pretty easy, but I'm at the point where I'm trying to get Django/Apache to play well together and it's not working. Since it's a 'module not foun...
Can libxmp be forced to register a namespace prefix when it won't take a suggested prefix? Question: I'm handling xmp data with [python-xmp- toolkit](https://code.google.com/p/python-xmp-toolkit/), which is a python wrapping of the exempi C library. We have an in-house namespace uri that we use in this data beginning ...
Python: Classes that use other classes Question: So I have 2 files that work together using each other's classes. I have class Student: """A class to model a student with name, id and list of test grades""" def __init__(self, name, id): """initializes the name and id number; ...