Join the social network of Tech Nerds, increase skill rank, get work, manage projects...

Python

## Tags

#### Help Me Understand Hangman Game Breakdown in Python

My question is with regards to the below code its a hangman game. I got this code online and trying to reverse engineer it so i can understand it better. My question is specifically regarding two lines , i need to understand the individual line...

#### How to Correct or Get The Mistake in This Python Code?

def greedy_cow_transport(cows,limit=10): train = [] while sum(cows.values()) > 0: cart = [] total = 0 for cow, value in sorted(cows.items(), key=lambda x:x[1], reverse=True): if cows[cow] != ...

#### How to Multiply Custom Weight to TFIDF Value Created by Word Vectors from Tweet Text in Python

How to Multiply Custom Weight to TFIDF Value Created by Word Vectors from Tweet Text in Python   Need a lil help with Python coding. I have a data frame as: Tweet Text   word1 word2 word3 word4 Tweet1    &nbs...

#### How to Display Power Set of 2 Sets of Fibonacci Series n and m?

Firstly the Fibonacci series is 1,2,3 not 5,8,2 it is not getting corrected. Secondly the correct power set is not getting generated. In the last is I want to generate two Fibonacci series of n and m (they can be same) and generate the power set ...

#### Can You Please Spot the Error in the Following Python Code?

How to display a powerset using the following code? what is the mistake and where? why the output is not getting displayed? What to do to display the output?   def power_set(items): N = len(items) # enumerate the 2 ** N pos...

#### How to Write Python Code (2.7 version) for the following Problem?

Write python code(2.7 version) for the following and also explain the logic because i am not understanding please explain.   Eight houses ,represented as cells , are arranged in a straight line.Each day every cell competes with its adj...

#### How to Start Developing a Web Application?

Hi there,   I am trying to create a Web Application but not sure where to start! Any ideas or any link for article or tutorial/video/post?   I know HTML, CSS, JS, Python, C and C++   Also, PHP, MySQL and MongoDB ...

#### Why Validation Accuracy Doesn't Change in Classification Using Stateful LSTM - Python

I am trying to classify some video into 3 different classes. Each video has different length of frame. The training data has the shape of (104, None, 528) where:     - 104 = Number of videos  - None = number of frames f...

#### I"m Getting Memory Error When Permutations/Combinations Exceeded 10 Elements

Hi I am new to python coding but would like to use it to generate all the permutations and combinations of a slot car track layout given a list of pieces of track. I figure each piece of track is a block that connects at each end. Curved pie...

#### How to Solve Optimization in scpy.optimize.minimize Problem?

I have a problem with optimizing of a function that contains loops. I start with paricular lista=[0.002,0.006,0.003,0.02,0.008,0.006,0.05] of floats and the intervals `(0,k*0.0025),(0.005,k*0.005),(0.005,k*0.0125), where upper border de...

#### How to Write Code in Recursive Version in Python for My Code

def sub_lists(list1): sublist = [[]] for i in range(len(list1) + 1): for j in range(i + 1, len(list1) + 1): sub = list1[i:j] sublist.append(sub) return sublist l1 = [1, 2, 3, 4] print(sub_lists(l1))

#### How to Implement Tweets Live Streaming Using Tweepy and Save Tweets in .csv file

I am a newbie to python,  after reading streaming with Tweepy and going through this example I am just trying to write tweepy app to crawl  live stream data with the tweepy Api and save it to .csv file but I &nb...

#### How to Merge Two Tables on Coded Columns Using Python

Hi guys!   I have two tables and I need to merge these two tables on columns left_on='A', right_on='B'. The problem is that 'A' column is coded 'B' column.   What would be the best optio...

#### How to Insert Data Contained in Entry Widgets on a GUI Correctly into SQL DB Created in Python?

In the code below the str entry widgets that I use the get method to retrieve data from, have been created earlier in the code.   I have tried the following ways to solve the problem: turning the list into a tuple using a list ...

#### String Passing in Python Class Methods - Output Error

My input string from a file is ANG 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 My required output should be 0.0 0.0 0.0 0.0 0.0 0.0 100 0.3 But Now my input is same as output .The last two zeroes under ANG string to be replaced as 100.0 and 0.3 respectively....

#### How to Call Background Function Using Linking Tkinter GUI to a separate Python File

I am having problem with having a GUI interface to be implemented via a second file which just contains the file to read, plots made and some new functions to be evaluated based on that.   I am trying to create a GUI application using Tki...

#### How to Get My Data of Output File Sorted in Python Program?

I want writing function for sorted_average() .  I calculated average of data in input file and write them in my output file. then i want sort data of out put file. but my cod not working...   my out put file is :  manda...

#### How to Fix Parameters & Return Function in Python Program Code?

How do I code the following program in Python?    [![program I have doubts in][1]][1]   (forget the third point)   This is what I've tried:      def bookstore(price,book):    ...

#### How to fix TypeError in Python: Object of type 'NoneType' has no len()

I'm currently trying to build an Agent for Starcraft 2 using the Pysc2 API, I'm getting by quite well however I've run into an issue that I can't seem to fix, if anyone has any idea it'd be much appreciated.   ...

#### How to Fix Cost Function in Binary Classification NAN as a Result in Python

I am quite new to both python and machine learning and I am trying to create an ANN for a binary classification model in order to determine whether something is faulty or not. When I run the code down below, the cost function seem to come up as n...

#### How to Convert a Python Code to C++ Programming language

I want to stream .dat files from a file i created in python, i wrote the python code and it worked great but i can't write it in C++, i need help to write that code in C++, Thank you.   The python code is as following :   ...

#### How to Schedule Archiving a Folder Daily with Specific Time in Python App?

def zipdir(path, ziph): #ziph is zipfile handle for root, dirs, files in os.walk(path): for file in files: ziph.write(os.path.join(root, file)) zipf = zipfile.ZipFile('test_python.zip', 'w', zipfile.ZIP_DEFL...

#### How to Remove Error 'No Such Element Exception' From Below Python Code

I am trying to run the following code: from selenium import webdriver # create a new Firefox session driver = webdriver.Firefox(executable_path=r'C:\Program Files\geckodriver.exe') driver.implicitly_wait(30) driver.maximize_window() ...

#### How to Resolve Running Session Failed Issue for Python Chatbot App Using Tensorflow

This is where I'm getting the error. I just want to ask what should I do, to make this code running. I'm building a chatbot using tensorflow. And mostly the error is encountered in the if-else statements. So please have a look at it. And ...

#### How to use an argument returned by a decorator in another decorator that is called after the first decorator

I am using two decorators to decorate a function "add_user", the first one @auth_user authenticates the logged in user via json web token request headers and returns the user's information as an argument "user_info" back t...

#### How can I Get Fetched Tweets Only One Time in Python Program?

How can I Get Fetched Tweets Only One Time in Python Program?  And in this case, I don't want to get retweets, or the same tweet more than once.   the following link has the code and a sample of the problem:   ...

#### How can I Make a Photobooth App Using Python Programming Language?

App must use the smart phone camera to capture image and store that captured image directly in pc instead of saving it into phone storage. Already Tried   https://www.pyimagesearch.com/2016/05/30/displaying-a-video-feed-with-openc...

#### How to Update Members Inside eMail Distribution List Using CSV Input File

Can the members inside a email distribution list be updated automatically, using csv file as input ? I have an email distribution list , next, I want to add members to this distribution list using csv file as input. note :- the csv...

#### How to Create Login Function in Python Programming Application

How do I create a login function where their username and password inputs are compared to a text document full of previously registered accounts to see if their input matches any accounts and if so calls another function?   Code so far...

#### How to Read Multiple Rows in Excel Sheet by Using XLRD in Python

I am currently using xlrd in python to read excel sheet. In column 1 contains test titles and column 37 contains test step. In column 1, there are some cell values like heading/Test case etc. I want to read all the rows in column 37 which are ...

#### Redistribute string entries in a huge pandas data frame in Pyhon

I have a data frame (derived from a CSV file) with about 100M entries that looks like this: df1: var1 var2 0 1 2 1 2 1 2 1 {3,4,5} 3 5 6 4 {4,5,6,7} 8 I need to convert this into a ...

#### what is the use of "@aNewDecorator" and "@wraps(aFunc)" in this decorators and how can i get my output?

from functools import wraps def aNewDecorator(aFunc):     @wraps(aFunc)     def wrapTheFunction():         print("Iam doing some boring work before executing aFunc().")       &...

#### Python TypeError: object of type 'NoneType' has no len()

I was unable to find what is wrong in the following code, The error msg is "object of type 'NoneType' has no len()"   My Code ------> A=[31,22,14,15] def merge(list1,list2): output=[] i=0 j=0...

#### Fixing a semi-redundant text file, best practice opinions wanted

First a little background: Link to attachments   I have a lot of text generated by some voice-to-text application (I honestly do not know the name of the application since I do not have physical access, however I have access to th...

#### Python Bigquery Connection Using Google BigQuery API Key and InsertQuery?

Hello everyone, I need help to insert data into bigquery using python. I am trying to make connection using bigquery API key using this method. service= build('bigquery', 'v2', developerKey='XXXXXXXXXXXXXXXXX') print service I am not ...

#### How Can I Listen to Events About the USB Port

Can anyone suggest me a library to listen to events on the usb port eg i want to know when a memory is connected?

#### Weasyprint only gives me empty pdfs when I'm trying to print newsarticles

#!/usr/bin/python3.5 from weasyprint import HTML url = "http://ekstrabladet.dk/112/nye-oplysninger-i-30-aar-gammel-mordgaade/6579176" HTML(url).write_pdf("test.pd") The problem is that the final pdf has only part of the webpage. I...

#### How to support persistent connections

I am fairly new to using python and servers most of what I know I have learnt from youtube. 1.I am trying to make a persistent connection but am not sure where I am going wrong 2. I also want to be able to send large files using chunked transf...

#### Making a Bar Graph on Rstudio with markdown

So I am using this data on Rstudio with markdown, but it reads that there is an error on the top line: Can you tell me how to fix this chunk of code so that it properly displays a barplot with the data from the link given? ```{r} ADHD_data ...

#### Import modules

I downloaded a python package, and installed it using pip command in Windows PowerShell. I cut-pasted site-package folder to the PATH where python is installed. But still when I import the module in python shell, it says that the module is not fo...

#### Can You Recommend Python Tutorials For Complete Beginners?

Hello Ladies & Gentlemen,  I would like to learn Python. Only latest version as of Jan 2017. I have a couple of question that I'm looking answer from you: Q1. What are your top best Python (latest version) programming tutoria...

#### Access Models.py from external py script

Hi, I am trying to integrate my existing code into django. How do i access models.py from my external code.I tried putting it in the same apps directory it did not work. Is there a way ?  My Case: I have a web parsing code that takes data...

#### its a basic question on how to calculate tax using python

Country X calculates tax for its citizens using a graduated scale rate as shown below: Yearly Income: 0 - 1000 Tax Rate: 0% Yearly Income: 1,001 - 10,000 Tax Rate: 10% Yearly Income: 10,001 - 20,200 Tax Rate: ...

#### How to Send a word to translation site from within a Python script?

Hi! How can I send, from within a Python script, a word to translation site and fetch the results?

#### Creating a backspace button on my calculator python tkinter GUI

Hello, i'm very new to python and  i would like to fix the "C" button so that it clears the last number on the display. For example 321 would become 32, i have tried a lot of things but i can't seem to get it to work, i wou...

#### How would I set the dict[value] to correspond to its dict[key] where the value itself is a dictionary?

How would I set the dict[value] to correspond to its dict[key]  where the value itself is a dictionary ?  I have a csv file where I am trying to count row[3] then connect it with row[0]      row[0]     &nb...

#### How to Write a Python program that Stores App Information in A Text File?

Write a Python program that reads in from a text file. You should briefly prepare a textfile containing information about items sold in a bakery. The information like type of buns,cookies, cakes and more with the price lists should be i...

#### Merging Panda Dataframes

I have two dataframes. One is user(UserID, Name) and other one is rating (srcUserId, dstUserId, RatingValue). I have to merge these two dataframes such that in place of srcUserId I get the name of the user corresponding to userid from user d...
prev 1
OR
OR
Register

OR
Fill out the form below and instructions to reset your password will be emailed to you:

• Hire
• Post Projects

### Post Projects

• All at 0 Cost ....
• Post Tech Job
• Select Best Bidder
• Track the Project
• Approve Work and Pay safely
• Browse Nerds
• Work
• Find Projects Find Projects
• UI Design and UX
• Software Engineering
View more...
View less...
• Marketing
• General
• Manage
• Company Company

### Manage Company

• All at 0 Cost ....
• Manage Company and Employee Profiles
• Company wide Employee Productivity Reports
• Knowledge Sharing and Collaboration Tools
• Get Sales Lead and Bid for Tech Projects
• Send Invoices and Receive Payment Safely
• Learn
• Nerd Digest Nerd Digest
• UI Design and UX
• Software Engineering
View more...
View less...
• Marketing
• General
• Tech Q & A Tech Q & A
• UI Design and UX
• Software Engineering
View more...
View less...
• Marketing
• General