15,179 Topics
| |
Another application of Python module base64, this time to embed midi music data in your program. You also need the module pygame to execute this Python code. Enjoy the music! | |
This is what I have: When I try to do this, it shows me an error: IndexError: list index out of range Could someone help? with open(os.path.join(path, file.replace(".root", ".txt")), 'r') as f: lines = f.readlines() htemp = TH1D(name, name, nBins, eMin, eMax) for i in range(len(lines)): htemp.SetBinContent(i + 1, float(lines[i])) … | |
Hey there. i want to set a variable to represent the last line of a text file how do i do that? or even better, how do i create a list of the lines of a text file? any suggestions? | |
import sqlite3 datafile = 'XZ704.DB' datadir = '/full_path_to/SQLITE_FILES/' db = datadir+datafile conn = sqlite3.connect(db) cur = conn.cursor() cur.execute("SELECT * FROM Airports LIMIT 1") --- OperationalError: no such table: Airports --- That works fine in a terminal but for some reason python 2.7 no like. I have tried full path, relative … | |
I am going to find out all messengers such as: WhatsApp, viber, Line, Telegram, instagram, Kik, facebook, And others that are Registered with a specific Phone Number. is there any way to do that in python? remember that I have the phone number but want to figure out the messengers … | |
The end goal is to create a program that runs when my hard drive is plugged into a computer. This program will attempt to verify that the user is me through username and password. Upon correct input, the program will allow access to the files on the hard drive. Incorrect … | |
A. Write a triangle solver that takes 3 inputs consisting of angles in degrees and length of sides in arbitrary units and, if possible (your program has to determine this), supplies all other angles and side lengths. There will be either 0 triangles, 1 triangle, 2 triangles or an infinite … | |
Hello, I have this home work question to be solved on a cloud ide: Create a class called ShoppingCart. Create a constructor that takes no arguments and sets the total attribute to zero, and initializes an empty dict attribute named items. Create a method add_item that requires item_name, quantity and … | |
We are going to simulate a seat reservation program (think airlines seats). The plane has NUM_ROWS rows, and each row has NUM_SEATS seats (form A on). For this assignment, set NUM_ROWS = 6, and NUM_SEATS = 5. Make sure you use these two constant variables in the program. | |
Two bank account: current and saving. User has to be asked to choose one, then withdraw money. How can I do a decrement of the balance each time I loop in this function?? if balance = 10 euro , withdraw 5 so remaining is 5. User is asked to quit … | |
#this program calculates the area of a right triangle #ask for input b=input('Enter the triangle base:') h=input('Enter the triangle height:') #Calculate and print area Area=(b*h)/2 Print '\n The base is '+str(b) + 'units' Print 'The height is 'str(h) + 'units' Print '\n The area is 'str(area + 'units' | |
Car Rental will rent cars to their customer. They have the potential to rent either petrol, diesel, electric, or hybrid cars. They have initially 40 cars in their rental pool made up of 50% petrol, 20% diesel, 10% electric and 20% hybrid. When a car is not rented it is … | |
You can put an image and text on a Tkinter button widget. This small code shows you how. The GIF image file you want to use for the button should be in the working directory, or you have to give it the full path. Incorporate the Python Image Library (PIL) … | |
I am doing a mini project on Caesar cipher, I found one program but can't understand the 29th line "key = -key". Please help me. # Caesar Cipher MAX_KEY_SIZE = 26 def getMode(): print('Do you wish to encrypt or decrypt a message?') print("'e' for encrypt and 'd' for decrypt") while … | |
Can anyone please help me to convert the Pseudo code to python code? receiveFile () { lastblock := 0 newblock := 0 ; repeat repeat event := getFrameFromUDP(m) ; case event of data : newblock := getBlockNoFromFrame(m) ; transmitAckOverUDP(newblock) | timeout: transmitAckOverUDP(lastblock) esac until newblock==lastblock+1 ; lastblock = newblock ; … | |
1) While working dates, when and why the local time and universal times are used? 2) Which multi-threaded program is recommended for reducing CPU usage? Why? | |
Hello everyone, I'm pretty new to python and I have found this code https://www.daniweb.com/programming/software-development/code/260268/restart-your-python-program to restart a python program. I have developed a little program and applied this function to it. By pressing a Button the function `resize()` is being called which triggers the `restart_program()` function. But when I start … | |
Just a relatively simple calculator using the Tkinter GUI. It has a few nice features such as correcting division by an integer (for older Python versions), error trapping, to and from memory buttons, and an editable display. The editable display allows you to backspace mistakes, and also to enter things … | |
python programming Your job for this question is to use Python turtle to draw any picture you'd like, making sure to meet the following requirements: Your code must use at least 1 if-statement, prompting the user to decide between 3 choices (e.g. colours, shapes, sizes, or anything else you'd like) … | |
Hi, I am trying to write a simple script that reads a file for two time stamps and then finds the delta. However, I can't get passed converting the time strings to datetime objects. I haven't done any coding since college and I everything I've read says this code should … | |
I need to make this python code to only take one parameter. Right now it takes multiple. def get_list(): return [input("Please enter a string: ") for i in range(int(input("Please enter the number of strings you want to input\n")))] def longest(lst): return max(lst, key = len) def alpha(lst): return [e for … | |
Hi there I am new to python. is there a program i could use to make a Clock with day and date in big fonts to help my gran with memory loss. regards Paul. | |
I am new to the forums and I am creating a Area Calculator for extra credit for a class I am in, but I am running into some problems. I have the program coded out the way it needs to operate I just can't seem to get it to loop … | |
This snippet defines a function restart_program() which restarts your python program from within your python program. | |
**Usage:** Provides a secure frontend object with restricted access to attributes of the backend object. | |
I'm writing a python program that will search for a password that is the first piece in a string. I'm using raw_input() to do it, and here's what the code is like list = ['Nether\n'] password = list[0] print password if raw_input('Please Enter Password: ') == password: print "Successful" This … | |
I am learning python from "Learn Python The Hard Way", I came across a source code "from sys import argv" and got an explanation that sys is a module from where argv is imported. Although, sounds simple but still not able to understand the concept behind. I would like to … | |
I want to convert my python code in JAVA. Please help | |
Hi, I am trying to open a large excel file (.xlsx) to ad some rows of data from another excel file. However, due to the size of the destination file i am getting the memory error. I tried the below, however when i create the worksheet object it is creating … |
The End.