Answer:
See Explaination
Explanation:
m=int(input("Please specify the number of elements in first list : "))
n=int(input("Please specify the number of elements in second list : "))
m1=1
list1=[]
n1=1
list2=[]
while m1<=m:
r1=int(input("input element {} of list1: ".format(m1)))
list1.append(r1)
m1+=1
while n1<=n:
list2.append(int(input("input element {} of list2: ".format(n1))))
n1+=1
def Intersection(list1,list2):
return set(list1).intersection(list2)
print("The intersection of two lists is {}".format(Intersection(list1,list2)))
Answer:
The answer is A4B₁₆ = 2635₁₀ = 101001001011₂
Explanation:
To convert from hexadecimal base system to binary base system, first you can do an intermediate conversion from hexadecimal to decimal using this formula:
where position of the x₁ is the rightmost digit of the number and the equivalents hexadecimal numbers to decimal:
- A = 10.
- B = 11.
- C = 12.
- D = 13.
- E = 14.
- F = 15.
A4B₁₆ = A*16²+4*16¹+B*16⁰ = 2560 + 64 + 11 = 2635₁₀
Now, you have the number transformed from hexadecimal to decimal. To convert the decimal number 2635 to binary: Divide the number repeatedly by 2, keeping track of each remainder, until we get a quotient that is equal to 0:
2635 ÷ 2 = 1317 + 1;
1317 ÷ 2 = 658 + 1;
658 ÷ 2 = 329 + 0;
329 ÷ 2 = 164 + 1;
164 ÷ 2 = 82 + 0;
82 ÷ 2 = 41 + 0;
41 ÷ 2 = 20 + 1;
20 ÷ 2 = 10 + 0;
10 ÷ 2 = 5 + 0;
5 ÷ 2 = 2 + 1;
2 ÷ 2 = 1 + 0;
1 ÷ 2 = 0 + 1;
Now, construct the integer part base 2 representation, by taking the remainders starting from the bottom of the list:
2635₁₀ = 101001001011₂
Answer:
#include <stdio.h>
int fib(int n) {
if (n <= 0) {
return 0;
}
if (n <= 2) {
return 1;
}
return fib(n-1) + fib(n-2);
}
int main(void) {
for(int nr=0; nr<=20; nr++)
printf("Fibonacci %d is %d\n", nr, fib(nr) );
return 0;
}
Explanation:
The code is a literal translation of the definition using a recursive function.
The recursive function is not per se a very efficient one.
1 & 4 because social media’s are your identity and posts show what you’re doing and what you’re posting about yourself / other people.