Question

Python: Firstly, create a function and all the work is to be completed as 1 function...

Python: Firstly, create a function and all the work is to be completed as 1 function inside the function: a loop to run 3 times generating a random number from 1-10 add those 3 numbers together. if the number is greater than or equal 25, print out, the numbers are large numbers else if the number is less than or equal to 5, the sum of the numbers is small and default, the number is average

0 0
Add a comment Improve this question Transcribed image text
Answer #1

If you have any doubts, please give me comment...

import Part3

inp_fname = "textinput_3.txt"

out_fname = "textoutput_"+inp_fname[10]+".txt"

fp = open(inp_fname, "r")

string = ""

for line in fp.readlines():

    string += line.strip()

fp.close()

result = Part3.countVowels(string)

print(result)

fout = open(out_fname, "w")

for ch in result:

    print(ch+" : "+str(result[ch]), file=fout)

fout.close()

Add a comment
Know the answer?
Add Answer to:
Python: Firstly, create a function and all the work is to be completed as 1 function...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Python: Firstly, create a function and all the work is to be completed as 1 function...

    Python: Firstly, create a function and all the work is to be completed as 1 function inside the function: a loop to run 3 times generating a random number from 1-10 add those 3 numbers together. if the number is greater than or equal 25, print out, the numbers are large numbers else if the number is less than or equal to 5, the sum of the numbers is small and default, the number is average

  • Python problem: Create a function (fun1) that adds two numbers together and returns the sum. Create...

    Python problem: Create a function (fun1) that adds two numbers together and returns the sum. Create another function (fun2) that uses that calls fun1, passing it two parameters, and prints your name the number of times that is returned from fun1 (so, if my fun1 returned the number 3, then I would see my name printed 3 times). Call fun2.

  • Part 1: Using Idle Write a Python Script that Does the Following 1. At the top...

    Part 1: Using Idle Write a Python Script that Does the Following 1. At the top of your program, import the math library as in from math import * to make the functions in the math module available. Create a variable and assign into it a constant positive integer number of your choice. The number should be at most 10. 1 Suppose we call this variable x for this writeup document Try something like x = 4 2. Create another...

  • Python For this one use the random library. First, create a function called getRands that will...

    Python For this one use the random library. First, create a function called getRands that will have a parameter called ceiling. Within that function, create a loop that will loop the 10 times and in each loop, it creates a variable that is an integer between 1 and the number in the variable ceiling. Then test if that integers is less than 3. If it is, print that number. Now call getRands and pass in the argument: 10. You must...

  • Python Create a function for the Fizz Buzz program (see Assignment01, Q11). The function takes the...

    Python Create a function for the Fizz Buzz program (see Assignment01, Q11). The function takes the following 3 arguments with default values: 1) max_iteration=100 2) fizz_divider=3 3) buzz_divider=5 The function iterates numbers from 1 to max_iteration any number divisible by fizz_divider, “print fizz” Any number divisible by buzz_divider, “print buzz” Any number divisible by fizz_divider and buzz_divider, print “fizz buzz” Otherwise, print the number

  • This is in python. I hit a coding block Create a While Loop that does the...

    This is in python. I hit a coding block Create a While Loop that does the following: a = a + -a until it is greater than b. Inside the loop, create a function that adds 10 to a if a = 0. Print the value that makes a greater than b. Make sure the correct answer matches the one listed below. b = 400 444.0892098500626 Saving and Exporting Save your notebook, name the file, download as an HTML file,...

  • Write a program in python that generates X random integers Num. Num is a random number...

    Write a program in python that generates X random integers Num. Num is a random number between 20 to 50. X is a random number between 10 to 15. Calculate and show the Smallest, Largest, Sum, and Average of those numbers. You are not allowed to use Python functions sample(), min(), max(), average(), sort(), sorted()!! HINTs: to find Smallest.... 1) X is a random number between 10 to 15... for example 11...this determines how many times the loop will happen...

  • In Python! Create the program that print out only odd numbers 1,3,5,7,9 Use either a while...

    In Python! Create the program that print out only odd numbers 1,3,5,7,9 Use either a while loop or a for loop to print only odd numbers 1, 3, 5, 7, 9 *tip: you can use range () function, or a condition with ‘break’ (e.g, while count < 10) In python!: Create a program that print out 12 months of a year and associated numbers (e.g., January 1, February 2…). Two lists should be created, and then loop through the list...

  • In the python: Note 1: You may not use these python built-in functions: sorted(), min(), max(),...

    In the python: Note 1: You may not use these python built-in functions: sorted(), min(), max(), sum(), pow(), zip(), map(), append(), count() and counter(). For questions 1, 2 and 4: Ask the user to enter the size of a list. Fill the list with random numbers 0-9 and print the list. 1- (8 points) luckyNumbers.py: Find the sum of the numbers in a list, except the number 7 is considered unlucky, so we ignore it and do not include 7's...

  • This is a python work, thank for helping! 7. (6 points) Write a function, countOfAndSmalest Number...

    This is a python work, thank for helping! 7. (6 points) Write a function, countOfAndSmalest Number Between(low, high, ignore, listOfNumbers), that takes as input three numbers and a list of numbers, and returns a list containing two items: 1) how many items in listOfNumbers are greater than low, less than high, and not equal to ignore 2) the smallest number in listOfNumbers that is greater than low, less than high, and not equal to ignore (or None if there is...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT