Skip to content

ValueError error in Python code when reading from CSV file

Hello am supposed to the steps below. I have finished but getting this error File “C:/Users/User/Desktop/question2.py”, line 37, in jobtype_salary[li[‘job’]] = int(li[‘salary’]) ValueError: invalid literal for int() with base 10: ‘SECRETARY a. Read the file into a lis…

How do I get random numbers that fully cover a range?

I’m trying to have random integers between (1,5) but the catch is displaying all of the values from the random integer in a for loop ranging of 10 loops. I only have access to randint() and random() methods in ‘random class’. Answer Based on clarifications in my other answer, I think you mea…

How to get parameter names from a parametrized string?

What I’d like is: I’ve looked through string.Template, it does only substitution. Is there a standard library way to do this? Because in case of regex, there would have to be a check if $smt is actually a valid Python variable name and so on. Answer string.Template, or one of its subclasses, store…