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
Illusion [34]
2 years ago
8

Write a function that takes as input a single integer parameter n and computes the nth Fibonacci Sequence number. The Fibonacci

sequence first two terms are 1 and 1. (so, if n = 2, your function should return 1). From there, the previous two values are summed to come up with the next result in the sequence 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, etc.
Computers and Technology
1 answer:
RSB [31]2 years ago
4 0

Answer:

Following are the code to this question:

def Fibonacci(n):#defining a method Fibonacci that accept a parameter

   a = 1#defining a variable a that holds a value 1

   b = 1#defining a variable b that holds a value 1

   if n <= 0:# Use if to check n value

       print("invalid number")#print message

   elif n == 2:#defining elif that check n equal to 2

        return 1#return 1

   else:#defining else block

       print(a)#print value of a

       print(b)#print value of b

       for i in range(2,n):#defining for loop to calculate series

           s = a + b# add value in s variable

           a = b # interchange value

           b = s# hold s value

           print(s)#print s value

Fibonacci(10)#calling method

Output:

1

1

2

3

5

8

13

21

34

55

Explanation:

In the above-given program code, a method "Fibonacci" is defined, which holds a value "n" in its parameter, and inside the method two-variable "a and b" is defined, that holds a value "1".

  • In the next step, if a block is defined that checks n value is less than equal to 0, it will print "invalid number" as a message.
  • In the elif, it checks n value is equal to 2 it will return a value that is 1.
  • In the else block, it will calculate the Fibonacci series and print its value.
You might be interested in
Lenny is working as an apprentice to a typesetter. He has been told to sort different font stamps based on their type. Match the
DedPeter [7]

Answer:

Serif without kerning is the first one

Italic is the second one

Bold is the third one

Serif with kerning is the fourth one

Explanation:

I had this question and got this correct

3 0
2 years ago
A(n) ______________ ________________ attack keeps the target so busy responding to a stream of automated requests that legitimat
Tanya [424]

Answer:

denial-of-service (DoS) attacks

Explanation:

8 0
3 years ago
Have a great day!
valina [46]

Answer:

thank you so much!

Explanation:

you seem like such a nice person! have a great weekend!

5 0
3 years ago
Read 2 more answers
When a switch is closed, completing an lr series circuit, the time needed for the current to reach one half its maximum value is
uysha [10]
The answer is <span>0.693 .  </span><span>When a switch is closed, completing an LR series circuit, the time needed for the current to reach one half its maximum value is 0.693   

</span>e^(-t/T) = 0.5 
<span>-t/T = ln(0.5) = -0.693 </span>
7 0
3 years ago
Classify each of the following acts as a violation of confidentiality, of data integrity, source integrity, or availability, or
AlexFokin [52]

Answer:

A) Violation of Confidentiality and Source Integrity:

Passwords are very confidential information and are usually protected by both the owner and the ower of the system (which in this case is Yahoo). To obtain the passwords, the hacker had to illegally gain access to the source of the data which is on Yahoo servers. Hence a breach of confidentiality and lack of adequate integrity on the part of Yahoo.

B) Source Integrity: Anthony accidentally cuts the electricity from the server room. Why would he be able to do that? how did he gain access into the server room? This speaks to source integrity. People should not be able to access the server room except they are authorised.

C) Source Integrity and Confidentiality: NSA finds an efficient method to break AES. AES refers to the Advanced Encryption Standard. AES is a symmetric encryption technology known as a block cipher.

It is used by the United States Government for the classification of information. Their ability to break this code speaks to Violation of Source Integrity. In this case, they haven't exactly hacked any document. However, any document that was encrypted using this technology is already compromised at the source.

D)   Anna registers the domain name, "JohnSmith" and refuses to let John Smith buy or use the domain name: Violation of Availability.

It is assumed here that John Smith was the original owner of the domain but it was highjacked at expiration and registered by Anna. This kind of breach is called Violation of Availability of the domain name.

E) Some malware encrypts the victim’s hard drive with a secret key and a criminal asks for a ransom to decrypt.

This move is called the Ransomeware attack. The Integrity of the source of information (which is the hard drive) is already compromised. This is a combination of Source Integrity or availability and confidentiality violation.

F) The wiretapping of a cell phone is a breach of confidentiality and data integrity.

G) when there is a vulnerability in a system or software that is unknown to those who should be interested, it is called a Zero-Day vulnerability. Where there is a Zero-Day vulnerability there could be a violation of confidentiality, data integrity, source data and or it's availability.

Cheers!

4 0
3 years ago
Other questions:
  • WHOEVER HELPS ASAP GETS BRAINLiEST!!!!!!!!! :)
    15·2 answers
  • What are some things you can do with labels in Word? Check all that apply. make them include audio print them on the inside of t
    13·1 answer
  • There are many careers within the IT industry. _____ are responsible for organizing a company's data, making sure all the data i
    9·1 answer
  • A car holds 16 gallons of gasoline and can travel 312 miles before refueling. Write aC++ program that calculates the number of m
    9·1 answer
  • What is a short sequence of characters that appears at the end of a filename and is preceded by a period called __________
    5·1 answer
  • What steps might a company or organization need take in order to keep its digital data secure online?
    8·1 answer
  • Convert each of the fo" wing base ten representations to its equivalent binary form a. 6 b. 13 C. d. 18 e. 27
    6·1 answer
  • 25 POINTS!!!!!!!!!!!!!
    8·2 answers
  • Wirte a program which asks the users to input length and calculates the area of a square.( Area = Length^2)​
    14·1 answer
  • How is your favorite singer and why I will give Brainliest
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!