basic

Palindrome Checker Assistance

Palindrome Checker Assistance Question: I need help with my Palindrome Checker using the provided instructions 🙁 If someone could show and explain the missing code, it would be a big help! Palindrome Checker Asked By: Silly Piggy || Source Answers: Let’s say you have a list: list1 = [1,2,3,4,5,6] You can use list1.append(7) to output …

Total answers: 1

basic python / sort messy dictionary

basic python / sort messy dictionary Question: I have eg p_deck={3:12, 5:23, 6:8, 9:47, 10:18} and need p_deck={0:12, 1:23, 2:8, 3:47, 4:18} what is the most efficient way of doing it? I tried: p_deck={3:12, 5:23, 6:8, 9:47, 10:18} p_keys_list=[] p_values_list=[] p_length=0 def order(): global p_keys_list global p_values_list global p_length p_keys_list=p_deck.keys() p_values_list=p_deck.values() p_length=len(p_deck) p_deck={} for i …

Total answers: 2

why does the dictionary key not update to record the change in keys

why does the dictionary key not update to record the change in keys Question: the goal is to increase the dictionary key by 1 so all values generated by for loop are stored in a dictionary code counting = {} numbers = 1 for i in range(1, 11): counting[numbers] = (i) numbers + 1 print(counting) …

Total answers: 2

Convert String with "." to int in python

Convert String with "." to int in python Question: I want to convert a string with a point to a int to us it in time import time x = "0.5" time.sleep(int(x)) i tried it with this simple code but i get this error ValueError: invalid literal for int() with base 10: ‘0.5’ is there …

Total answers: 2

ZX81 BASIC to Pygame Conversion of "Dropout" Game

ZX81 BASIC to Pygame Conversion of "Dropout" Game Question: I based the code below on this article: http://kevman3d.blogspot.com/2015/07/basic-games-in-python-1982-would-be.html and on the ZX BASIC in this image: 10 LET P=0 20 LET T=P 30 FOR Z=1 T0 10 35 CLS 37 PRINT AT 12,0;T 40 LET R=INT (RND*17) 50 FOR Y=0 TO 10 60 PRINT AT …

Total answers: 1

How to extract Integer from Pytorch Tensor

How to extract Integer from Pytorch Tensor Question: This is a part of code… VSCODE declares variable > xyxy as ‘list’ for *xyxy, conf, cls in reversed(det): if save_txt: # Write to file xywh = (xyxy2xywh(torch.tensor(xyxy).view(1, 4)) / gn).view(-1).tolist() # normalized xywh line = (cls, *xywh, conf) if opt.save_conf else (cls, *xywh) # label format …

Total answers: 1

Python: Is there an equivalent of mid, right, and left from BASIC?

Python: Is there an equivalent of mid, right, and left from BASIC? Question: I want to do something like this: >>> mystring = "foo" >>> print(mid(mystring)) Help! Asked By: pythonprogrammer || Source Answers: If I remember my QBasic, right, left and mid do something like this: >>> s = ‘123456789’ >>> s[-2:] ’89’ >>> s[:2] …

Total answers: 8