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
Does anyone have 2.19.4 Guess a number 2.0 code for codehs?
lubasha [3.4K]

Answer:

I'm trying to create a program that will ask the user for an exam score in the range 0 to 100. ... I want to take the python course but I have not class code, anyone can help?

Explanation:

3 0
3 years ago
You would set a ___________ to prevent users from immediately changing their password several times in one day to return to the
Temka [501]

Answer:

The answer is (B) Maximum password age.

Explanation:

To prevent several changing of passwords by a user in a day, the maximum times a password can be rest within a day is normally set by  the system administrator.

The setting ensures the password is returned to the current settings of the password on the system for the user and prevents unnecessary changing of passwords in a day by user.

6 0
4 years ago
Read 2 more answers
Please help me with question 1!
BaLLatris [955]

12,831 is the answer but if you care for the work then here it is:

Since its a percent then its a certain percentage of the whole. Therefore you take 13,650 x 94% or 0.94 which will give you the answer of the amount of people that are familiar with it.

4 0
3 years ago
Read 2 more answers
Write a program that unpickle's employee dictionary and while reading from the dictionary, it allows users to lookup an employee
melamori03 [73]

Answer:

Check the explanation

Explanation:

from Employee import *

import pickle

import random

def unpickle_employee(filename):

file=open(filename,'rb')

data=pickle.load(file)

file.close()

return data

def pickle_employee(data,filename):

file=open(filename,'wb')

pickle.dump(data,file)

file.close()

if __name__=='__main__':

filename="Employees.dat"

'''

E=Employee("Ajay",1,"R&D","Manager")

data={}

data[1]=E

pickle_employee(data,filename)

'''

data=unpickle_employee(filename)

 

while True:

print("\nData In Employee.dat")

for d in data:

print("Employe data: ",data[d].get_name(),"({},{},{})".

format(data[d].get_id_number(),data[d].get_department(),data[d].get_job_title()))

 

print("\n\n\t\tMenu")

print("To add new Employee, Enter a")

print("To update any Employee, Enter u")

print("To delete any Employee, Enter d")

print("Enter anything to quit")

choice=input("Enter: ")

if choice=='a':

id_number=random.randrange(100,200,1)

while id_number in data:

id_number+=1

if id_number>=200:

id_number=100

name=input("Enter the Name: ")

department=input("Enter the Department: ")

job_title=input("Enter the job title: ")

E=Employee(name,id_number,department,job_title)

data[id_number]=E

elif choice=='u':

id_number=int(input("Enter the Employee id_number to update: "))

for d in data:

print(id_number,d,d==id_number)

if id_number in data:

print("Employe data: ",data[id_number].get_name(),"({},{})".

format(data[id_number].get_department(),data[id_number].get_job_title()))

print("\nPlease Enter the details")

name=input("Enter the Name: ")

department=input("Enter the Department: ")

job_title=input("Enter the job title: ")

E=Employee(name,id_number,department,job_title)

data[id_number]=E    

else:

print("Employee doesn't exist\n")

elif choice=='d':

id_number=int(input("Enter the Employee id_number to delete: "))

if id_number in data:

print("Employe data: ",data[id_number].get_name(),"({},{})".

format(data[id_number].get_department(),data[id_number].get_job_title()))

choice=input("\nPlease Enter y to confirm, anything else to cancel: ")

if choice=='y':

del data[id_number]

else:

print("Employee doesn't exist\n")

else:

break

pickle_employee(data,filename)

7 0
3 years ago
Queues can be represented using linear arrays and have the variable REAR that point to the position from where insertions can be
Levart [38]

Answer:

8

Explanation:

7 0
3 years ago
Other questions:
  • ACCOUNTING
    13·2 answers
  • You are troubleshooting a network issue on a client computer and discover that the network card has an IP address of 169.254.196
    6·1 answer
  • How many homes can be warmed by one bugatti
    11·2 answers
  • PLEASE HELPP!! WILL MARK BRAINLIEST!!~~~~~
    11·1 answer
  • Give a logical expression with variables p,q, and r that is true if p and q are false and r is true and is otherwise false.
    5·1 answer
  • A(n ____ is anything about which data are to be collected and stored.
    8·1 answer
  • If you're unsure if something
    9·2 answers
  • Prewritten, commercially available sets of software programs that eliminate the need for a firm to write its own software progra
    7·1 answer
  • WAP to find area of circle​
    12·1 answer
  • The most widely used computer device​
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!