1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Allushta [10]
3 years ago
13

Write a program that asks the user to input a positive integer and then calculates and displays the factorial of the number. The

program should call a function named getN
Computers and Technology
1 answer:
mestny [16]3 years ago
6 0

Answer:

<em>The program is written in python and it doesn't make use of any comment; </em>

<em>(See explanation section for line by line explanation)</em>

def getN(num):

     fact = 1

     for i in range(1, 1 + num):

           fact = fact * i

     print("Factorial: ",fact)

num = int(input("Number: "))

if num < 0:

     print("Invalid")

else:

     getN(num)

Explanation:

The function getNum is defined here

def getN(num):

Initialize the result of the factorial to 1

     fact = 1

Get an iteration from 1 to the user input number

     for i in range(1, 1 + num):

Multiply each number that makes the iteration

           fact = fact * i

Print result

     print("Factorial: ",fact)

Ths line prompts user to input number

num = int(input("Number: "))

This line checks if user input is less than 0; If yes, the program prints "Invalid"

if num < 0:

     print("Invalid")

If otherwise, the program calls the getN function

else:

     getN(num)

You might be interested in
Give an example of a situation in which a compromise of Confidentiality leads to compromise in Integrity.Situation where confide
il63 [147K]

Answer: An example of such a scenario would be when the user name and password meant to allow access to a customers bank account statement is cracked by unauthorized people this causing alteration (in the form of data diddling attacks) in the data contained in the statement. This is a compromise in integrity.

Explanation:

Confidentiality entails securing things people want to remain secret. An account statement of a bank customer is a confidential document which is to be kept secret. A password allows access to it.

Integrity implies receiving a sent data/information as accurately as it came from a sender. A data diddling attack alter integrity because the original information is altered by an unauthorized person.

7 0
3 years ago
To ensure that comments identify the initials of the person making changes, you would need to _____.
nadezda [96]

Answer:

Its B.change the user name.

Explanation:

hope it helps!

mark me brainliest :))

8 0
3 years ago
Read 2 more answers
9.2 lesson practice ​
makvit [3.9K]

Answer:

6 columns/items

Explanation:

<em>grid</em> starts off as an empty list ( [ ] ), so right now it has 0 items/columns.

After that, 3 new items ("frog", "cat", "hedgehog") have been appended to <em>grid</em>, it now has 3 items

Finally another 3 items are appended to <em>grid ("fish", "emu", "rooster"</em>), finally <em>grid</em> ends up with 6 items in total.

5 0
2 years ago
How can I make my Wi-Fi signal fast? I am going through my exam but my Wi-Fi is not supporting plz help.
9966 [12]

Answer: Maybe try to move router.

Explanation:

8 0
3 years ago
Teenagers and their parents will never understand each other-the generation gap is too big. Its for my grade 11 English speech​
bazaltina [42]

Answer:

lol

Explanation:

lol

7 0
3 years ago
Read 2 more answers
Other questions:
  • Write a program in python that ask the user to enter a word and then capitalizes every other letter of that word
    15·1 answer
  • A _____ is a climate-controlled building or set of buildings that houses database servers and the systems that deliver mission-c
    6·1 answer
  • Extinction of a species is always a negative impact on the Earth.<br><br> True<br> False
    8·1 answer
  • Write a program that asks the user for two file names. The first file will be opened for input and the second file will be opene
    8·1 answer
  • What does RFID use for wireless communication?<br> Infrared<br> IoT<br> Smart chip<br> Tag
    14·1 answer
  • What is social media ​
    13·2 answers
  • The advancement of technology in our daily lives has changed how we interact with the world.
    10·1 answer
  • To create an SSL connection, a Web server requires a ________, which is an electronic document that confirms the identity of a w
    12·1 answer
  • Which tab should a user click to access the Page Borders feature of Word?
    13·2 answers
  • 1.erros can easily be ____ 2.work is done in an ____ no mess environment 3.colors do not _____ and brushes are never ______ 4.st
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!