Warning: Trying to access array offset on value of type bool in /home/topgsnkq/public_html/nurselite.com/wp-content/themes/enfold/framework/php/function-set-avia-frontend.php on line 637

Python programming

General information/requirements/grading rulesThis homework tests your knowledge of Functions. So you need to use functions to get grades.Adhere to the naming conventions discussed in class for variable names, program name and function namesUse meaningful names for variablesIf there are two words in the variable use first word lowercase and first letter of second wordupper case i.e., firstName or underscore between 2 words i.e first_nameInclude appropriate comments in the codeOutput should be displayed exactly as mentioned against each problemIndent the lines of code appropriatelyprimeNum.py (20 points)Write a program that displays all of the prime numbers from 1 through 10. The program should have a loop that calls the is_prime function.Hints:Declare local variables under main() programFor each number, print whether or not it is prime.Write for loop, use range function to loop through the total numbers.Call is_prime functionprint if the number is prime or not primeDefine is_prime function, ‘def is_prime(number):’The is_prime function receives a number as an argument, and returns True if number is prime, False otherwise.Sample Output:number      is prime————————1      not prime2      prime3      prime4      not prime5      prime6      not prime7      prime8      not prime9      not prime10      not primecalories.py (25 points)Write a program that calculates following and display Grams of fat, Fat calories, Grams of carbs, Carb calories in 2 decimal positions.the number of calories that result from the fat using formula:Calories from fat = fat grams * 9the number of calories that result from the carbohydrates using formula:Calories from carbs = carb grams * 4Hints:Declare local variables under main() programPrompt the user to enter grams_fat and grams_carbsCalculate calories from fatCalculate calories from carbsDefine a function to display resulting calories -def showCarbs(gramsFat, gramsCarbs, caloriesFat, caloriesCarbs):Note: This function will be called from main()Sample Output:If fat grams consumed entered is 87If carbohydrate grams consumed entered is 39 then the output would be:Grams of fat:  87.00Fat calories:  783.00Grams of carbs:  39.00Carb calories:  156.00testscore.py (25 points)Write a program that prompts the user to enter 5 test scores. The program should display a letter grade for each score and the average test score.Hint:Declare local variables under main() programPrompts the user to enter 5 test scoresDefine a function to calculate the average score: this should accept 5 test scores as argument and return the avgDefine a function to determine the letter grade: this should accept a test score as argument and return a letter grade based on the following grading scale.Score         Letter Grades90-100                A80-89                   B70-79                   C60-69                   DBelow 60            FSample Output:score                   numeric grade   letter grade—————————————————-score 1: 99.0                     Ascore 2: 78.0                     Cscore 3: 68.0                     Dscore 4: 99.0                     Ascore 5: 89.0                     B—————————————————-Average score:  86.6                     B4. randomGuess.py (30 points)Write a program that generates a random number in the range of 1 through 20, and asks the user to guess what the number is.If the user’s guess is higher than the random number, the program should display “Too high, try again”.If the user’ guess is lower than the random number, the program should display “Too low, try again”.If the user guesses the number, the application should congratulate the user and generate a new random number so the game can start over.The game continues until the user chooses to quit by entering 0 as input anytime.Sample Output:Enter a number between 1 and 20, or 0 to quit: 14Too high, try againEnter a number between 1 and 20, or 0 to quit: 5Too low, try againEnter a number between 1 and 20, or 0 to quit: 10Too low, try againEnter a number between 1 and 20, or 0 to quit: 13Congratulations! You guessed the right number!Enter a number between 1 and 20, or 0 to quit: 10Too high, try againEnter a number between 1 and 20, or 0 to quit: 5Too low, try againEnter a number between 1 and 20, or 0 to quit: 7Too low, try againEnter a number between 1 and 20, or 0 to quit: 9Congratulations! You guessed the right number!Enter a number between 1 and 20, or 0 to quit: 0Thanks for playing!

 
"Looking for a Similar Assignment? Order now and Get 10% Discount! Use Code "Newclient"

"Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!":

Get started