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
Fofino [41]
4 years ago
13

Write a python script that uses random to generate a random grade (4.00 grading scale) inside a loop, and that loop keeps runnin

g until it generates a 4.00 GPA.
Computers and Technology
1 answer:
bija089 [108]4 years ago
7 0

Answer:

Following are the program in the Python Programming Language.

#import the random package to generate random number

import random

#declare variables and initialize to 10 and 0

num = 10

count=0

#set for loop  

for i in range(1,num):

 #set variable that store random number

 n = random.randint(0,5);

 #set if conditional statement

 if(n==4):

   #print count and break loop

   print("Count:%d"%(count))

   break

 #increament in count by 1

 count+=1;

<u>Output</u>:

Count:4

Explanation:

<u>Following are the description of the program</u>.

  • Firstly, import required packages and set two variable 'num' initialize to 10 and 'count' initialize to '0'.
  • Set the for loop that iterates from 1 to 9 and inside it, set variable 'n' that store the random number, set if conditional statement inside it print the count and break the loop and increment in count by 1.
You might be interested in
Documenting Business Requirements helps developers control the scope of the system and prevents users from claiming that the new
tiny-mole [99]

Answer:

The answer is "True".

Explanation:

Industry demands documentation enables developers to monitor the system's range and protects users claims, that somehow the new system will not accomplish their business goals.

  • The main goal of this report is to offer everyone to be transparent, about what should be accomplished and when.  
  • It is the new business plan, that should be outlined in detail, that's why the given statement is true.
3 0
3 years ago
Write and application that reads five integers from the user and determines and prints the largest and the smallest integers. Us
mixas84 [53]

Answer:

#include <stdio.h>  

#include <limits.h>  

 

/* Define the number of times you are going  

  to ask the user for input. This allows you  

  to customize the program later and avoids the  

  hard coding of values in your code */  

#define NUMVALS 5  

 

int main(void)  

{  

   int i = 0;  

   int curval = 0;  

   /* Set your initial max as low as possible */  

   int maxval = INT_MIN;  

   /* Set your initial min as high as possible */  

   int minval = INT_MAX;  

 

   /* Loop through and ask the user for the defined  

      number of values */  

   for (i = 0; i < NUMVALS; i++)  

   {  

       /* Ask the user for the next value */  

       printf("Enter the next value: ");  

 

       /* Get the next value from the user */  

       scanf("%d", &curval);  

 

       /* Check to see if this is our biggest or  

          smallest value yet */  

       if (curval > maxval)maxval = curval;  

       if (curval < minval)minval = curval;  

   }  

 

   /* Output the results */  

   printf("The smallest value entered was: %d \n", minval);  

   printf("The largest value entered was: %d \n", maxval);  

 

   /* End the program */  

   return 0;  

}

Explanation:

5 0
3 years ago
Trish uas bought a new computer, which she plans to start working on aftwr a week. Since Trish has not used computers in the pas
stepladder [879]

The answer would be B. She should minimize the use of the computer. Hope this helps! :)


<h3>CloutAnswers</h3>
6 0
3 years ago
Write a complete program in Assembly Language: 1. Promts the user to enter 10 numbers. 2. saves those numbers in a 32 bit intege
Delicious77 [7]

Answer: provided in the explanation section

Explanation:

i hope this helps.

DATA SEGMENT

ARRAY DB 1,4,2,3,8,6,7,5,9

AVG DB ?

MSG DB "AVERAGE = $"

ENDS

CODE SEGMENT

ASSUME DS:DATA CS:CODE

START:

MOV AX,DATA

MOV DS,AX

LEA SI,ARRAY

LEA DX,MSG

MOV AH,9

INT 21H

MOV AX,00

MOV BL,9

MOV CX,9

LOOP1:

ADD AL,ARRAY[SI]

INC SI

LOOP LOOP1

DIV BL

ADD AL,30H

MOV DL,AL

MOV AH,2

INT 21H

MOV AH,4CH

INT 21H

ENDS

END START

cheers i hope this helps!!!

5 0
3 years ago
Read 2 more answers
What would happen to a eukaryotic cell if all its mitochondriawere destroyed
julsineya [31]
The cell won't reproduce ATP.
4 0
3 years ago
Other questions:
  • A series of inventions led to the creation of the electronic digital computer shortly after this war..
    12·1 answer
  • Where can you access all the formatting options for worksheet cells?
    5·1 answer
  • Darian has a gourmet cupcake business and needs a website to compete with the other bakeries in his area. He has a Google My Bus
    15·1 answer
  • When using ntfs as a file system, what can be used to control the amount of hard disk space each user on the machine can have as
    8·1 answer
  • What is related to Gamut in Adobe illustrator?
    8·1 answer
  • What are the benefits of transferable skills check all the boxes that apply
    6·2 answers
  • Katla is a project manager. One of the programmers on her team comes to her and says that he permanently deleted some code mista
    5·1 answer
  • Evaluate the advantages and disadvantages of cloud computing.
    12·1 answer
  • Derek is creating an animation for his class project. What is the first step Derek should follow while creating the animation?
    11·2 answers
  • Today's consoles and games have audio features that rival cinematic audio.<br> True or False?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!