[Solved] infinite while loop python

[ad_1] Your second while loop has no break point!!! Your first while loop runs until it detects motion and then enters the second loop, and your second loop runs forever. If you want both loops to work simultaneously then you should use threads!!! If not then make a break point in second loop. Simple example: … Read more

[Solved] scraping with selenium web driver

[ad_1] You should fix your XPath expressions. Use findElement for the first 3. findElements for the last. To get the home odd : //td[a[.=”bet365″]]/following-sibling::td[span][1]/span To get the draw odd : //td[a[.=”bet365″]]/following-sibling::td[span][2]/span To get the away odd : //td[a[.=”bet365″]]/following-sibling::td[span][3]/span To get them all : //td[a[.=”bet365″]]/following-sibling::td[span]/span Getting them all is probably better since you call driver.find_elements_by_xpath 1 … Read more

[Solved] Answer Error, Only outputting Zero

[ad_1] How to debug your (small) program Okay so let’s start from the top and go line-by-line. There’s a lot of issues here. aLimit=300 bLimit=500 cLimit=100 aPrice=20 bPrice=15 cPrice=10 ticketSold=1 totalIncome=0 These are all globals since you defined them in the module scope. That’s a Bad Thing. Don’t do it. If they’re constants, use CAPS … Read more

[Solved] Python FOR Loop [closed]

[ad_1] Python alternative for your function def test(): for i in range(1, 10): print(i) Note out that python has no variable declaration as it is not strongly-typed language. Also instead of next it has indentation as depth of execution. [ad_2] solved Python FOR Loop [closed]

[Solved] Append not working like expected [closed]

[ad_1] You repeatedly append the same Mutation, and end up with multiple references to it in the list. If you want different Mutations, you have to make new ones. (I assume that’s what you think is the “problem”, as you never explicitly say what is wrong about the output.) 2 [ad_2] solved Append not working … Read more

[Solved] Python class information from variable

[ad_1] Yes. Both animal and giraffe are references to the same underlying object. Very much like “Jala015” and “Jala Smith” and “mom” (or dad?) might all be references to the same person. Similarly, if you change the continent of the object via one of the references, that change will be visible through the other reference, … Read more

[Solved] What is wrong with this code? I cant figure it out

[ad_1] days_of_week = [‘Sunday’, ‘Monday’, ‘Tuesday’, ‘Wednesday’, ‘Thursday’, ‘Friday’, ‘Saturday’] You forget the , after the ‘Thursday’, that’s why it will out of range. your code: def main(): # Variables total_sales = 0.0 # Initialize lists daily_sales = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] days_of_week = [‘Sunday’, ‘Monday’, ‘Tuesday’, ‘Wednesday’, ‘Thursday’, ‘Friday’, ‘Saturday’] for … Read more

[Solved] I need help Funtion sort a-z condition [closed]

[ad_1] Hope you got the logic from my code below, if you have any questions, please ask them 😀 name1 = input(“Name 1 : “) name2 = input(“Name 2 : “) choose = input(“Select first or last : “) if choose == “first”: if name1 < name2: # check if name1 is in front of … Read more

[Solved] Whats wrong with my JSON Object [closed]

[ad_1] Youre missing a closing ] at the bottom, this will work { “results”: [ { “text”: “@twitterapi http://tinyurl.com/ctrefg”, “to_user_id”: 396524, “to_user”: “TwitterAPI”, “from_user”: “jkoum”, “metadata”: { “result_type”: “popular”, “recent_retweets”: 109 }, “id”: 1478555574, “from_user_id”: 1833773, “iso_language_code”: “nl”, “since_id”: 0, “max_id”: 1480307926, “refresh_url”: “?since_id=1480307926&amp;q=%40twitterapi”, “results_per_page”: 15, “next_page”: “?page=2&amp;max_id=1480307926&amp;q=%40twitterapi”, “completed_in”: 0.031704, “page”: 1, “query”: “%40twitterapi” } … Read more

[Solved] python program to store a specific string from a file and store it in a variable

[ad_1] First off In your example json file you have inconsistent use of quotation marks, chose ‘ or ” and stick to it. Code import json data = json.load(open(“file.json”)) # this is the variable you are after variable = data[“my_id”] [ad_2] solved python program to store a specific string from a file and store it … Read more