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
SCORPION-xisa [38]
4 years ago
12

Write a Python program to do the following:

Computers and Technology
1 answer:
viktelen [127]4 years ago
5 0

Answer:

(b)Tb = Ta[:3]

(c)Tc = Ta[-3:]

(d)Td = Tb + Tc

Explanation:

In order to generate random number in python, we need to first import random() function from random module

This function will generate a float number between 0 and 1, to make it between 1 and 15, we add 1 to the multiplication between the random number and the range differences

(a)

from random import random()

L = []

for i in range(10):

    L.append(1 + round(random()*14))

Ta = tuple(L)

(b) To copy the first 3 elements of tuple Ta, we simply go from : to 3

Tb = Ta[:3]

(c) To copy the last 3 elements of tuple Ta, we simply go from -3 to :

Tc = Ta[-3:]

(d) To concatenate the 2 tuples, we simply add them up

Td = Tb + Tc

You might be interested in
When you select Insert and click on a shape the mouse pointer turns into a/an
Gennadij [26K]

It turns into crosshairs

6 0
3 years ago
Read 2 more answers
Suppose you have a 12-hour clock on a very fancy chair (noon is 12 PM and midnight is 12 AM). Write a C++ program that reads in
agasfer [191]

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:

4 0
3 years ago
How to help it automation with python professional certificate?
arlik [135]

Answer:

Following are the answer to this question:

Explanation:

As we know, that Python is based on Oop's language, it allows programmers to decide, whether method or classes satisfy the requirements.  

  • It's an obvious benefit, in which the system tests the functions, and prevent adverse effects, and clear the syntaxes, which makes them readable for such methods.
  • All the framework uses the python language, that will be used to overcome most every coding task like Mobile apps, desktop apps, data analyses, scripting, automation of tasks, etc.
3 0
3 years ago
Describe how you could obtain a statistical profile of the amount of time spent by a program executing different sections of its
Mazyrski [523]

Answer:

Explanation:

It can be said that the best way to obtain such a statistical profile would be to issue a periodic timer interrupt, then you would simply need to monitor which what code was running when the interruption took place. This information is especially helpful to the programmers as it would allow them to optimize the specific sections of the code that are consuming the most CPU resources, and thus making the overall program more efficient.

7 0
3 years ago
Suppose you want to encode the numerals 0–9 and the 26 letters of the alphabet, using separate codes for lowercase and uppercase
labwork [276]

Lets first work out how many different codes would be needed to represent everything. 26 for lowercase, 26 for uppercase, and 10 for 0-9. Total, that makes 62 needed codes.

If we start with 0, we need to go up to 61 to represent all the characters. Thus, we can convert 61 to binary and count the number of digits needed to represent that as the last number in the set and that will tell us how many digits are needed.

61 in binary is 111101, so we need 6 digits to represent that number. The answer is B.

4 0
4 years ago
Other questions:
  • If you quote an author from a website in a paper, it will be important to create a _____ in your writing to give them credit for
    7·2 answers
  • Write a statement that declares a PrintWriter reference variable named output and initializes it to a reference to a newly creat
    5·1 answer
  • when a page contains function is loaded the browser by passes the function without running it - true or false
    7·1 answer
  • Why is time management considered a soft skill
    10·2 answers
  • . If you have written the following source code:
    9·1 answer
  • Google's Chrome OS integrates with web servers using cloud computing and storage to run applications and to perform other functi
    10·1 answer
  • is there anybody out there who is a social butterfly like me? If so then you can tlk to me on this. and to anybody out there tha
    12·1 answer
  • I have no idea what I’m doing and this is due in 45 minutes
    7·1 answer
  • Hello :) new day <br> which one would u pick?<br> 1. chips 2. Gacha life 3. chocolate?<br><br> hehe
    15·2 answers
  • Why are men more exposed to mass media?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!