15,406 Topics

Member Avatar for
Member Avatar for Ashwini_6

Want to clear how to write a program to store the given telephone details in dictionary and print all the number whose name starts with e. Data =('Einstein':1234567896),('newton':2478965782),('Alexander':9876543216)

Member Avatar for sahilmohile15
0
209
Member Avatar for srinivasa reddy_1

class subjectGradeBook(object): def __init__(self): self.grades={} def addStudents(self,name): self.grades[name]={} def reportGrade(self,name,subject,grade): k=self.grades[name] gradeList=k.setdefault(subject,[]) gradeList.append(grade) def averageGrade(self,name): k=self.grades[name] total,count=0,0 for grades in k.values(): total+=sum(k) count+=len(k) return total/count book = subjectGradeBook() book.addStudents('AlbertEinstein') book.reportGrade('AlbertEinstein', 'Math', 75) book.reportGrade('AlbertEinstein', 'Math', 65) book.reportGrade('AlbertEinstein', 'Gym', 90) book.reportGrade('AlbertEinstein', 'Gym', 95) book.averageGrade('AlbertEinstein')

Member Avatar for woooee
0
332
Member Avatar for Toddh86

I'm making a device that will display the weeks and days until a specific date (in this case my wifes maternity leave start). I am using a Raspberry Pi with a 4" screen. The plan is to use a python script to display full screen the weeks and days left …

Member Avatar for rproffitt
0
298
Member Avatar for bharathsharma

I'm developing a GUI using wxPython (Boa Constructor IDE). My GUI has the following: Rich text control Start button Stop Button My requirement is that when I press the START button, numbers (1, 2, 3, etc.) should start printing in the text control; it should stop when I press the …

Member Avatar for gdtraveller
0
456
Member Avatar for nadiam

hi. i have a really basic question (really new to python). how do i read an entire binary file? from https://www.devdungeon.com/content/working-binary-data-python , `data = binary_file.read()` is to read the whole file at once. so i have a .dng file to test, which is 16.2mb, and i did: with open("portrait1.dng", "rb") …

Member Avatar for Gribouillis
0
54K
Member Avatar for ihatehippies

I have a wx.DatePickerCtrl with the dropdown popup window that allows the user to pick a date from the calendar. What I would l like to have my program do is process an event when the user has clicked on a day in the dropdown calendar. Unfortunately the only native …

Member Avatar for gdtraveller
0
2K
Member Avatar for Nicole_7

A person starts out as the "Curator" and stands at the end of a field. Everyone else playing stands at the far end (distance depends upon playing area selected). The object of the game is for a "Statue" to tag the Curator, thereby becoming the Curator and resetting the game. …

Member Avatar for Gribouillis
0
795
Member Avatar for abders

This is my custom module: [CODE]class Player(object): def __init__(self, name, score = 0): self.name = name self.score = score def __str__(self): rep = self.name + ":\t" + str(self.score) return rep def ask_yes_no(self, question): response = None while response not in ("y", "n"): response = input(question).lower() return response def ask_number(self, question, …

Member Avatar for Kaushik_2
0
989
Member Avatar for random_1

Hi. I have a .raw file and I want to display it as hex. why? because i want to try and replicate what 010 Editor can do which is read any sort of file and display in whatever format user desires (plus it can be used to edit and stuff) …

Member Avatar for Gribouillis
0
9K
Member Avatar for Nemius

Hi, i am working on program that connect to database, and user then cans see, edit, insert and delete data in mysql database. I have problem whit update query, can somone help me whit this. User need to click on cell and enter/change data, then hit enter to save changes. …

Member Avatar for woooee
0
593
Member Avatar for _hack

Greetings I'm fairly new to python, and I know that this is possible but I'm having trouble with syntax: I'm reading a file from the command line and putting it's contents into a dictionary. Keys are repeated in the file, so the values must be placed within a list. In …

Member Avatar for woooee
0
18K
Member Avatar for CoOlBeAnZ

I want to make a game that allows users to make a log in which requires them to make a username and password,I will then give them an option whether they woul like to register or log in.This is where I am stuggling as I dont know how to save …

Member Avatar for Shankar.Shiv
0
2K
Member Avatar for pallen

I'm jumping into Python/Django, and have been hitting some speed bumps. I'm a somewhat novice programmer. I know the basics, but haven't done anything more than create a PHP webform, and build very simple websites. I have a thousand questions about Django (most centering around Views and customizing the Admin, …

Member Avatar for JO_4
0
961
Member Avatar for Gabi_1

I have a file where I must find and delete a string, which in this case is called 'queue'. After I delete it, I must then delete all the following lines until a '[' character is found. I can't figure out how to do this, being a newbie in python …

Member Avatar for Reverend Jim
0
253
Member Avatar for Aayush_3

Using the code in class Coin as a base write in a file and do the following 1. Create two coin objects coin1 and coin2 2. Demonstrate that they are both show() “Heads” 3. Demonstrate that if you turn() either of them they show “Tails” 4. Add a new member …

Member Avatar for rproffitt
0
154
Member Avatar for Dihyan

for example, i have this code def awal(): a = 2 def akhir(): print(a) awal() akhir() well i got error that said a is not defined? i used global, same error use return, same error any idea why?

Member Avatar for Shankar.Shiv
0
506
Member Avatar for i dont know

Hello all, i need your help regaring this code, which is in python and i need to convert it into mips?? register $s0 holds the base address of list my_data, $s1 holds the length of the list my_data, register $s2 holds the base address of list my_data2 and $s3 holds …

Member Avatar for rproffitt
-1
3K
Member Avatar for Shankar.Shiv

Hello friends i want to create a database for Login system. Means i just need to create and connect the database to my python file and taking some data in that database from user. For example like signup login form but in system application.

Member Avatar for rproffitt
-1
357
Member Avatar for massivefermion

I'm trying to run a project that uses Django and uWSGI in a Docker container. But I'm new to Docker and uWSGI so I'm not quite sure how I'm supposed to do it. At first I build the project with the below command: docker build -t saleor . Then I …

Member Avatar for massivefermion
0
691
Member Avatar for Jonathan_26

So for this program im trying to print out the max height the projectile reaches and when i run the __str__ on the object it dosent change the value to the string and just gives a garbage result. the program als o prints some other vaulues but my problem is …

Member Avatar for vmanes
0
394
Member Avatar for Traj

import turtle import os import math import random import pygame #set up the screen wn = turtle.Screen() wn.bgcolor("black") wn.title("Space invaders") wn.bgpic("space_invaders_backgrounds.gif") pygame.init() #Register the shapes turtle.register_shape("ship.gif") turtle.register_shape("Enemy.gif") #Drawing my border border_pen = turtle.Turtle() border_pen.speed(0) border_pen.color("white") border_pen.penup() border_pen.setposition(-300,-300) border_pen.pendown() border_pen.pensize(3) for side in range(4): border_pen.fd(600) border_pen.lt(90) border_pen.hideturtle() #Set the score to …

0
330
Member Avatar for Tcll

If you're in one of those predicaments where `cls.__private` attributes just aren't enough since they can easily be accessed through `inst._cls__private`, and you need something a little more secure, here's a method I've been playing with for a while that fills that gap. Note that this uses `__slots__`, more info …

Member Avatar for Tcll
0
864
Member Avatar for otengkwaku

Hi guys have a python software that i want to freeze for distribution. The problem is after freezing it with cx_freeze and i run it, it works fine on my development computer but when i sent it to my testing computer (window XP sp3 32bit) it give me this error …

Member Avatar for Thomas Karl
0
2K
Member Avatar for ashi_1

Write a python script for mass renaming music files according to labels. The script takes an existing format of files in current directory and an expected output format and prints a list of old -> new file name tuples. Format can be any string that contains any number of the …

Member Avatar for pty
0
558
Member Avatar for random_1

from PyQt5 import QtCore, QtGui, QtWidgets # Import the PyQt5 module we'll need import sys # We need sys so that we can pass argv to QApplication import design # This file holds our MainWindow and all design related things # it also keeps events etc that we defined in …

0
2K
Member Avatar for Kushmitha

Hi everyone, I struck with this code for few day , please help me and thanks in advance . Write the class AddressBook so the following code works: c = AddressBook() c.add(name='ynon', email='ynon@ynonperek.com', likes='red') c.add(name='bob', email='bob@gmail.com', likes='blue') c.add(name='ynon', email='ynon@gmail.com', likes='blue') c.find_by(name='ynon') # returns: # [ # {'name': 'ynon', 'email': 'ynon@ynonperek.com', …

Member Avatar for rproffitt
-1
310
Member Avatar for renjana

i couldnt install numpy in python3.3 windows 7 i have installed setuptools bt easy_install is unavailable if i try to install NumPy i get an error like "Command "python setup.py egg_info" failed with error code 1 in c:\users\20149308 \appdata\local\temp\pip-build-b5n89o\NumPy\"

Member Avatar for You_2
0
213
Member Avatar for random_1

Hello, so im trying to use PyQt5 on my windows 7 but I might not be doing it right or something. So ive done `pip install SIP` and `pip install pyqt5`. Following [this](http://projects.skylogic.ca/blog/how-to-install-pyqt5-and-build-your-first-gui-in-python-3-4/) post, Ive done `from PyQt5 import QtCore, QtGui, QtWidget` and I should have a **designer.exe** somewhere for …

Member Avatar for Chris_48
0
461
Member Avatar for United_2

numbers = [2,3,1,5,7,8,9,5,4,6] print(numbers) tool_1 = int(input()) tool_2 = int(input()) x = numbers.index (tool_1) y = numbers.index (tool_2) numbers[x] = (tool_2) numbers[y] = (tool_1) print(numbers) So I want this code to run until the numbers list is in this exact order 1,2,3,4,5,6,7,8,9 Is there a Do until loop or someway …

Member Avatar for Tcll
0
460
Member Avatar for Chris_48

I was looking around the web for a "selectable label" in tkinter, everyone seems to point to a disabled text entry. I wanted to share mine thus far. I plan to modify this so that when the label is selected, you can click an "edit" button elsewhere in the program …

Member Avatar for woooee
0
945
Member Avatar for Siberian

Where or can someone help me on using Visual Studio Code; as I installed a Python extension and I can't get the console / debugger to show the results of the code ?

Member Avatar for tinstaafl
0
576
Member Avatar for Hanan_4

https://pypi.python.org/pypi/autosub/0.3#downloads How do I run this code? Can someone please help me out

Member Avatar for rproffitt
0
144
Member Avatar for Talruk

For some reason the make_great function is not affecting the output of the show_magicians function. I'm trying to alter the list but it's not working. # the make_great function is not affecting the show_magicians function as # intended magicians = ['david', 'caroline', 'benjamin', 'alex', 'steve'] def make_great(magicians_to_change): for magician in …

Member Avatar for rproffitt
0
285
Member Avatar for SHEKINA

python code implementation of firefly algorithm for feature selecting the hepatitis dataset

Member Avatar for happygeek
0
191
Member Avatar for Tahir007

Hi guys, I developed JIT compiler for Python. It compiles simplified Python code directly to x86 native code. Focus here is usage on SIMD instructions. With SIMDy you can easily outperform C++ in compute intensive tasks like monte carlo simulations, rendering, fluid simulations, etc... Web(WIP): www.tahir007.com I would like to …

0
184
Member Avatar for Ivan_17

I have the following code I wrote on windows 7: canvas_width = 150 canvas_height = 150 brush_size = 3 color = "black" def paint(event): global brush_size global color x1 = event.x - brush_size x2 = event.x + brush_size y1 = event.y - brush_size y2 = event.y + brush_size w.create_oval(x1, y1, …

Member Avatar for Ivan_17
0
362
Member Avatar for Jack_30

I need a function that will create and store usernames and passwords for different students. Their programme should ask the user for their name and age and a username should be created, consisted of their name and age eg. Jack16. They then can make up their own password which then …

Member Avatar for benanamen
0
566
Member Avatar for vegaseat
Member Avatar for Daniele_2
4
19K
Member Avatar for Guilherme_1

Hello there! I'm wondering what are the options I have. My skills are not adequate for this kind of task. But I'm thinking now about either seeking for a partner with sufficient skills or hiring team of developers. In both cases what could you advise? What competence is needed for …

Member Avatar for Marcus_4
0
694
Member Avatar for Bhuwan_1

I am creating a client server program on which client downloads server's files. it works fine in localhost, but the problem occurs in except localhost connection. I've tried googling but none of the solutions(from previously suggested to the same problem) works. Here is my code: def upload(sock): # server.py filename …

Member Avatar for rproffitt
0
709
Member Avatar for Talruk

I've been reading through a beginner's book for Python, and I can't quite get this example to work perfectly. active = True age = "" while active: age = input("Please enter your age ") if str(age) == 'quit': active = False elif int(age) < 3 and int(age) != 0: price …

Member Avatar for Talruk
0
184
Member Avatar for random_1

Hello. I'm learning tkinter and trying out the opening file bit and im obviously doing something wrong. def init_window(self): self.txt = Text(self) self.txt.pack(fill=BOTH, expand=1) def open_file(self): filetypes = [('All files', '*')] dialog = filedialog.Open(self, filetypes=filetypes) showD = dialog.show() if showD!= '': text = self.readFile(showD) self.txt.insert(END, txt) def readFile(self, filename): with …

Member Avatar for rproffitt
0
214
Member Avatar for Adam_40

Hey there, I am trying to create a register code. So basicly im making a quiz and every time a user starts up my program he/she needs to register (making a unique username/pass) -When registered it will ask to login. Could anyone help me make the code? My code so …

Member Avatar for Adam_40
0
640
Member Avatar for Jamshaid _1

Hi guys i need some help i am tryig to code a python fake bank system. The program needs to be able to deposit withdraw,check the balance and quit the program however my code doesnt seem to be working for some reason can someone please help me. Please find attached …

Member Avatar for Adam_40
0
609
Member Avatar for Poongkuyil
Member Avatar for HoneyBadger

Guys, I am trying to change the background color of my window in WxPython. Here is what I got: Why doesn't it work? [CODE]import wx class my_window(wx.Frame): def __int__(self, parent, id): wx.Frame.__int__(self,parent,id,'My Window', size=(300,200)) self.Colours() def Colours(self): self.pnl1.SetBackgroundColour(wx.BLACK) if __name__ == "__main__": app=wx.PySimpleApp() frame=my_window(parent=None,id=-1) frame.Show() app.MainLoop()[/CODE]

Member Avatar for Rufus_1
0
11K
Member Avatar for Viking_2

So I have to write a program that takes the amount and weight of pumpkins entered by a person and then outputs them back with their corrisponding weight class that i specify. I keep getting a syntax error on the elif statement and I was wondering if i could have …

Member Avatar for hericles
0
365
Member Avatar for omojolinho

Using Python, tokenize using space as a parameter. Count the total number of words in the document and the frequency of each word. Also, identify the word with least frequency appearance and most frequency appearance

Member Avatar for rproffitt
0
224
Member Avatar for Howard_2

Hey been practicing coding using Python 3 tutorial,my question is how to put what learn into a project,or should I say how or what information is their to get this mindset

Member Avatar for pty
0
228
Member Avatar for mattrweaver

I have two dataframes and I need to separate rows where a value from pmdf matches one of the codes in jcrdf.All_codes. If pmdf.code is in jcrdf.All_codes, I need a dataframe with all values from jcrdf AND pmdf.count. Dataframes: pmdf = pd.DataFrame( { 'code': ['0567-8315','0007-4977','0096-0225','1365-2133','8675-309J'], 'count':['6','7','10','2','1'] } ) jcrdf = …

0
138

The End.