[Solved] Indentation error basic program [closed]

You should indent your main function with spaces or tabs. (4 spaces is recommanded) Like this: def main() num=input() # rest of your main code main() I saw you already did this for if/else, you should also do it for functions. I recommend you take a beginner python course like the one of codecademy. solved … Read more

[Solved] Pass multiple numbers into an Add method that uses a params modifier?

Something along these lines should work. I might have made syntax errors 😀 using System; class Program { static void Main(string[] args) { var calculator = new Calculator(); var input = GetNumbers(); calculator.Add(input); Console.WriteLine(calculator.Add(input)); } public static int[] GetNumbers() { Console.WriteLine(“Enter Numbers Seperated With a Space”); string input = Console.ReadLine(); //Get user input with this … Read more

[Solved] how to add just the values in key s1 [closed]

If you want to add all the values of s1, you need to iterate over the values() of dictionary students. students={ 1: {“pup1”: “001”, “s1”: 10, “s2”: 20}, 2: {“pup2”: “124”, “s1”: 20, “s2”: 30}, 3: {“pup3”: “125”, “s1”: 30, “s2”: 40}} sum1 = 0 for data in students.values(): sum1 += data[‘s1’] avg = sum1 … Read more

[Solved] Regex for string that validates for a number which may include decimal and for a particular length [closed]

Run this code and test with all your inputs.It should solve your scenario. String regex = “^[0-9.]{5}$”; Pattern pattern = Pattern.compile(regex); String name= “123.4”; Matcher matcher = pattern.matcher(name); System.out.println(matcher.matches()); 1 solved Regex for string that validates for a number which may include decimal and for a particular length [closed]