"python –version" dont work but "py –version" work

I’m a beginner in python and development in general and I’m facing a really strange problem. When I use the command "py –version" in CMD it works perfectly but if I use the command "python –version" it tells me "Python is not found". I don’t know where the problem from ( I used deepl to translate my question sorry for strange translation)

encryption – Is there some way to verify that what I think I encrypted is actually what was encrypted when I don’t have the private key? (PGP)

Let’s say that Joe gives his PGP public key to Sue so that Sue can send Joe a secret message.

Sue opens her PGP/GPG program, types I'm in love with Joe! and encrypts the message with Joe’s public key.

The result is a blob that only Joe can read, because only he has the private key to his public key.

When Joe receives the blob and decrypts it using his private key, the message reads: I hate you, Joe!!.

How is this possible? Well, Sue’s computer has been compromised by a jealous third party, Ken. Ken secretly installed a mechanism which changes the messages just before the PGP/GPG program uses the public key to encrypt the message, so that the wrong message is encrypted instead of the intended one.

Is there any way that Sue could have verified that the blob she sent to Joe actually contained the message she thought she inputted, when she doesn’t have the private key? I of course don’t mean to decrypt the message, but some kind of “true/false” answer whether the blob corresponds to exactly a given text. Is that possible?

(She does the verification on a separate, non-compromised computer.)

c# – Replace string based on multiple rules, don’t replace same section twice

Given a 2-column CSV dictionary file that contains translation of certain words, this c# code needs to replace the first occurrence of a word in the dictionary.

  • Once a segment of string has been replaced, it cannot be matched or overwritten by a new dictionary word.

This sounded like a fairly simple task but the code I came up with runs horribly slow and I’m looking for ways to improve it.

All the offending code is in the TestReplace function, I build up a hashset that keeps track of what character Ids in the string have been touched. When you apply a rule that changes the lenght of the string, all the character ids switch around so they have to be recalculated and I believe it costs a lot of performance. Wish there was a simpler way to do this !

Here is a super simple case of what the code tries to do :

Dictionary file:

hello >>> hi

hi >>> goodbye

Input: hello, world!

First rule is applied so string becomes -> hi, world. The word hi is now locked.

Second rule is applied but the string does not become goodbye, world since this part is locked.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace stringReplacer
{
    class Program
    {
        public static Dictionary<string, string> ReplacementRules = new Dictionary<string, string>()
        {
            {"John","Freddy" },
            {"John walks","Freddy runs" },
            {"brown dog","gray dog" },
            {"dog","cat" },
            {"- not -", "(not)" },
            {"(","" },
            {")","" },
            {"whenever",  "sometimes, when"},
            {"raining", "snowing" },
            {"his", "many" }
        };

        static void Main(string() args)
        {
            string Input = "John walks his brown dog whenever it's - not - raining";
            string ExpectedOutput = "Freddy walks many gray dog sometimes, when it's (not) snowing";

            string TestReplaceOutput = TestReplace(Input, ReplacementRules);
            ValidateReplacement("TestReplace", TestReplaceOutput, ExpectedOutput);
        }
        public static string TestReplace(string input, Dictionary<string, string> ReplacementRules)
        {
            HashSet<int> LockedStringSegment = new HashSet<int>();

            foreach (var rule in ReplacementRules)
            {
                string from = Regex.Escape(rule.Key);
                string to = rule.Value;
                var match = Regex.Match(input, from);
                if (match.Success)
                {
                    List<int> AffectedCharacterPositions = Enumerable.Range(match.Index, match.Length).ToList();

                    if (!AffectedCharacterPositions.Any(x => LockedStringSegment.Contains(x)))
                    {
                        input = Regex.Replace(input, from, to);
                        int LengthDelta = to.Length - rule.Key.Length;

                        LockedStringSegment
                            .Where(x => x > match.Index + rule.Key.Length).OrderByDescending(x => x).ToList()
                            .ForEach(x =>
                            {
                                //We shuffle the locked character's place depending on the replacement delta.
                                LockedStringSegment.Remove(x);
                                LockedStringSegment.Add(x + LengthDelta);
                            });

                        //Add all the new locked character's position to the hashset.
                        Enumerable.Range(match.Index, to.Length).ToList().ForEach(x => LockedStringSegment.Add(x));

                    }
                }
            }

            return input;
        }
        public static void ValidateReplacement(string MethodName, string Actual, string Expected)
        {
            Console.Write($"{MethodName} : ");

            if (Expected != Actual)
                Console.WriteLine("String replacement doesn't work");
            else
                Console.WriteLine("It works");

            Console.WriteLine($"Expected : {Expected}");
            Console.WriteLine($"Actual   : {Actual} nn");

        }

    }

}

pathfinder 1e – I’m frustrated with my archer-based cleric – I feel useless in combat, and I feel like I don’t have the resources to change that

I am in a relatively new campaign (level 5) and I just came into about 9k gold. I am a cleric and there is pretty much nothing I can buy that I haven’t already. I have 12 str, so no more than a plus one on my composite long bow. I have a nice set of hide but low dexterity, so no more medium armor worth buying. All enchants are absolutely obscene in price, or so useless they don’t do anything. No magical items that I can use are within my price range, and the worst part is, I feel absolutely useless in my group. My spells do virtually nothing, my bow cant hit anything because I CONSTANTLY role like Satan himself is channeling his personal hatred towards me through my dice, and I don’t have enough strength to be anything but a minor inconvenience to most melee enemies. I know I probably am missing something huge, but are there some things people could recommend for me to buy to be remotely helpful for my group?

For clarification, I have 12-Str 15-Dex 18-Con 12-Int 20-Wis 10-Cha. I am a Dwarf, just a classic cleric, mostly focused on healing with the Healing and Good domains. I have Channel Smite and Guided Hand as my two feats. For gear, I have a normal set of breastplate and a +1 non-magical composite longbow and all the rest of my gear is normal adventuring gear. I have no magical items.