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:
#include<iostream>
#include<cmath>
#include <ctime>
using namespace std;
int main()
{
time_t t = time(NULL);
tm* timePtr = localtime(&t);
cout << "seconds= " << (timePtr->tm_sec) << endl;
cout << "minutes = " << (timePtr->tm_min) << endl;
cout << "hours = " << (timePtr->tm_hour) << endl;
cout << "day of month = " << (timePtr->tm_mday) << endl;
cout << "month of year = " << (timePtr->tm_mon)+1 << endl;
cout << "year = " << (timePtr->tm_year)+1900 << endl;
cout << "weekday = " << (timePtr->tm_wday )<< endl;
cout << "day of year = " << (timePtr->tm_yday )<< endl;
cout << "daylight savings = " <<(timePtr->tm_isdst )<< endl;
cout << endl;
cout << endl;
cout << "Date " <<(timePtr->tm_mday)<<"/"<< (timePtr->tm_mon)+1 <<"/"<< (timePtr->tm_year)+1900<< endl;
cout << "Time " << (timePtr->tm_hour)<<":"<< (timePtr->tm_min)<<":"<< (timePtr->tm_sec) << endl;
return 0;
}
Explanation:
Answer:
(d) 6
Explanation:
When we call factorial(3) first it will check if it greater than 1 since it is greater then return 3*factorial(2) will be called on factorial(2) it will again check that 2>1 since it is greater then return 2*factorial(1) will be called.In factorial(1) we have is not greater than 1 so it will return 1.return 2*factorial(1) will return 2 and 2 that is returned by factorial(2) will be multiplied with 3.So it will return 6.
Answer:
The function written in C++
int str(string word)
{
int count = 1;
for(int i =0; i<word.length();i++)
{
if(word[i] == ' ')
{
count++;
}
}
return count;
}
Explanation:
This line defines the function
int str(string word)
{
This line initializes count to 1
int count = 1;
This line iterates through the input string
for(int i =0; i<word.length();i++)
{
This line checks for blank space
if(word[i] == ' ')
{
Variable count is incremented to indicate a word count
count++;
}
}
return count;
}
<em>See attachment for full program</em>
Answer:
am not really sure but between TCP/IP and data link am sorry for not being precise .