[Solved] i have developed the program and i am facing problems in it

You can try to pivot the table. Which may give the format you require. Considering the information you gave as as ActionsOnly.csv userId,movieId,rating 18,9,3 32,204,4 49,2817,1 62,160438,4 70,667,5 73,1599,1 73,4441,3 73,4614,3.5 73,86142,4 95,4636,2 103,71,1 118,3769,4 150,4866,2 You wan to find out what user rated what movie out of 5. The userId is the index column, … Read more

[Solved] Pig Latin Translator won’t give out a word

I suspect the indentation/syntax errors are issues with SO and/or lazy copying, as I can replicate your failure example with fixed code: Everything is compared lowercase except the vowels list, which is in all caps. it needs to be aeiou, as A != a and everything else is lowercase. You still have to fix your … Read more

[Solved] Reverse the list while creation

Well designed test shows that first function is slowest on Python 2.x (mostly because two lists have to be created, first one as a increasing range, second one as a reverted first one). I also included a demo using reversed. from __future__ import print_function import sys import timeit def iterate_through_list_1(arr): lala = None for i … Read more

[Solved] Flask App will not load app.py (The file/path provided (app) does not appear to exist)

You haven’t got anything in your template called blogposts. You need to use keyword arguments to pass the data: return render_template(‘index.html’, blogposts=blogposts) Also note you should really do that query inside the function, otherwise it will only ever execute on process start and you’ll always have the same three posts. 4 solved Flask App will … Read more

[Solved] Hours and time converting to a certain format [closed]

This can be done conveniently by using the appropriate representation for your fractional hours, namely a timedelta. If the input is of datatype string, convert to float first. Ex: from datetime import datetime, timedelta for td in [8.25, 17.75]: # add the duration as timedelta to an arbitrary date to get a time object: print((datetime(2020,1,1) … Read more

[Solved] How to extract a field from this payload with a regex? [duplicate]

Edit: The data you provided is a JSON string. You can convert it to a dictionary using the json package: import json payload = u'{“encrypted_sender_transaction_id”:”514658451″,…}’ obj = json.loads(payload) print obj[‘donation_info’][‘amount’] # 1 obj is a nested dictionary in this case, amount is a key in the subdictionary under the key donation_info 2 solved How to … Read more

[Solved] How to make random characters and numbers appear all over the screen, from up to down like an animation? [closed]

You can activate your program via the command prompt and then write this block of code in python: import random import shutil columns, rows = shutil.get_terminal_size(fallback=(80, 24)) size_of_console = columns * rows for i in range (size_of_console): print(chr(random.randint(33, 126)), end = ”) make sure you have the right libraries installed and you are good to … Read more

[Solved] How do I check elements of the list here [closed]

The definition of valid_list should be out of the for loop, otherwise it will be overwritten. Besides, use a flag_valid to indicate whether the invalid elements exist. Try this code: from itertools import permutations def code(): valid_list = [] for line,lists in enumerate(permutations(range(4))): flag_valid = True for index,elements in enumerate(lists): if index != len(lists) – … Read more

[Solved] Extract single words or phrases from list of strings which are not in base string

Update This version adds all already seen words to the exclude set: exclude = set(‘why kid is upset’.split()) list_of_strings = [‘why my kid is upset’, ‘why beautiful kid is upset’, ‘why my 15 years old kid is upset’, ‘why my kid is always upset’] res = [] for item in list_of_strings: words = item.split() res.append(‘ … Read more