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
Gre4nikov [31]
3 years ago
11

Write a program to read from std_info.txt.

Computers and Technology
1 answer:
slavikrds [6]3 years ago
6 0

Answer:

import pandas as pd

# loads the text file as a pandas dataframe

student_file = pd.read_fwf("std_info.txt")

# opens a new text file if the student_avg does not exist

# the file closes automatically at the end of the with statement

with open('student_avg.txt', 'w+') as file:

   for row in student_file.iterrows():

       file.write(row)

   ee = student_file[student_file['major'=='EE']]

   cpe = student_file[student_file['major'=='CPE']]

   file.write(f'EE average = {ee['EE'].mean()}')

   file.write(f'CPE average = {ee['CPE'].mean()}')

   file.write(f'Total average = {student_file['EE'].mean()}')

Explanation:

The python program gets the text file as a fixed-width file and loads the file as a pandas dataframe. The dataframe is used to get the total average GPA the student GPA and the average GPA of students in various departments. The results are saved in a new file called 'student_avg.txt'.

You might be interested in
The major difference between a template and another document is in.​
tensa zangetsu [6.8K]
Templates in pandadoc are used for generic content that you intend on using multiple times, while documents are used for specific information. In order to send a document, you must first creat it from an existing template.
4 0
3 years ago
What would be the value of discountRate after the following statements are executed? double discountRate = 0.0; int purchase = 1
Karolina [17]

Answer:

The value of discountRate would be 0.01

Explanation:

double discountRate = 0.0;

     int purchase = 1250;

     if (purchase > 1000)

     discountRate = .05;

     if (purchase > 750)

     discountRate = .03;

     if (purchase < 2500)

     discountRate = .01;

     else discountRate = 0;

discountRate is declared as 0.0 then purchase is 1250. But the entire if statement is sequential, that is; all the if statement are executed.

first if-statement assign .05 to discountRate because purchase is greater than 1000.

Next if-statement re-assign .03 to discountRate because purchase is greater than 750.

The last if-statement re-assign .01 to dicountRate because purchase is less than 2500. Since this is the last if statement executed, the value of discountRate is .01

4 0
3 years ago
In some database programs, a data file is referred to as a(n) ______.
Illusion [34]

In some database programs, a data file referred to as a table option (a) is correct.

<h3>What is a database?</h3>

A database in computer is a structured data collection that is technologically accessible and stored.

The question is incomplete.

The complete question is:

In some database programs, a data file is referred to as a(n) ______.

a. table

b. unit

c. record

d. sheet

A data file is known as a table in some database applications.

A database system contains vital info about a business; when the data is processed, it becomes valuable knowledge about the business and aids in choice.

Thus, in some database programs, a data file referred to as a table option (a) is correct.

Learn more about the database here:

brainly.com/question/6447559

#SPJ4

8 0
1 year ago
You need to implement a web application that is split in three parts, namely, Webpage, PHP and MySQL. Each of them will be used
Anastasy [175]

Answer:

Check the explanation

Explanation:

index.php

<!DOCTYPE html>

<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->

<!--[if IE 7]> <html class="lt-ie9 lt-ie8" lang="en"> <![endif]-->

<!--[if IE 8]> <html class="lt-ie9" lang="en"> <![endif]-->

<!--[if gt IE 8]><!--> <html lang="en"> <!--<![endif]-->

<head>

</head>

<body>

<section class="container">

   <div class="login">

     <h1>Login Portal</h1>

     <form method="post" action="login.php" name="frm" onSubmit="return f1();">

       <p><input type="email" name="email" value="" placeholder="Enail"></p>

       <p><input type="password" name="pwd" value="" placeholder="Password"></p>

       <p class="submit"><input type="submit"   value="Login"></p>

     </form>

       <p class="submi"><a href="admin_signup.php" > <input type="button"   value="Signup"></a></p>

   </div>

</section>

</body>

</html>

login.php

<?php

session_start();

$con=mysqli_connect("localhost","root","","storage");

if(!$con)

{

die("connection failed" .mysqli_connect_error());

}

$e=$_POST["email"];

$p=$_POST["pwd"];

$sql="select * from `account` where `email`='$e' and `password`='$p'";

$res=mysqli_query($con,$sql);

if(mysqli_num_rows($res)>0)

{

$_SESSION["email"]=$e;

include 'profile.php';

}

else {

echo "no such username";

include 'admin.php';

}

mysqli_close($con);

?>

admin_signup.php

<!DOCTYPE html>

<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->

<!--[if IE 7]> <html class="lt-ie9 lt-ie8" lang="en"> <![endif]-->

<!--[if IE 8]> <html class="lt-ie9" lang="en"> <![endif]-->

<!--[if gt IE 8]><!--> <html lang="en"> <!--<![endif]-->

<head>

</head>

<body>

<section class="container">

   <div class="login">

     <h1>Signup Portal</h1>

     <form method="post" action="signup.php" name="frm" onSubmit="return f1();">

        <p><input type="email" name="email" value="" placeholder="Email id"></p>

       <p><input type="text" name="uname" value="" placeholder="Admin name"></p>

       <p><input type="password" name="pwd" value="" placeholder="Password"></p>

       <p class="submit"><input type="submit"   value="Signup"></p>

     </form>

       <p class="submi"><a href="admin.php" > <input type="button"   value="Login"></a></p>

   </div>

</section>

</body>

</html>

signup.php

<?php

session_start();

$con=mysqli_connect("localhost","root","","storage");

if(!$con)

{

die("connection failed" .mysqli_connect_error());

}

$u=$_POST["uname"];

$e=$_POST["email"];

$p=$_POST["pwd"];

$sql="INSERT INTO `account`(`email`, `username`, `password`) VALUES ('$e','$u','$p')";

mysqli_query($con,$sql);

mysqli_close($con);

include 'admin.php';

?>

upload file (profile.php)

<!DOCTYPE html>

<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->

<!--[if IE 7]> <html class="lt-ie9 lt-ie8" lang="en"> <![endif]-->

<!--[if IE 8]> <html class="lt-ie9" lang="en"> <![endif]-->

<!--[if gt IE 8]><!--> <html lang="en"> <!--<![endif]-->

<head>

</head>

<body>

<section class="container">

   <div class="login">

     <h1>Login Portal</h1>

     <form method="post" action="content.php" name="frm" onSubmit="return f1();" enctype="multipart/form-data" >

       <p><input type="test" name="docname" value="" placeholder="docname"></p>

       <p><input type="file" name="filename" value="" placeholder="file path"></p>

       <p class="submit"><input type="submit"   value="upload"></p>

     </form>

     <p > <a href="view.php">to view your content , click here</a></p>

   </div>

</section>

</body>

</html>

content.php

<?php

session_start();

$con=mysqli_connect("localhost","root","","storage");

if(!$con)

{

die("connection failed" .mysqli_connect_error());

}

$handle = $_FILES['filename']['tmp_name'];

echo $handle;

$d=$_POST["docname"];

$e=$_SESSION["email"];

$c=file_get_contents($handle);

$sql="INSERT INTO `info`(`email`, `docname`, `content`) VALUES ('$e','$d','$c')";

mysqli_query($con,$sql);

mysqli_close($con);

include 'admin.php';

?>

to view content , view.php

<?php

session_start();

$con=mysqli_connect("localhost","root","","storage");

if(!$con)

{

die("connection failed" .mysqli_connect_error());

}

$e=$_SESSION["email"];

$sql="select * from `info` where `email`='$e' ";

$res=mysqli_query($con,$sql);

if(mysqli_num_rows($res)>0)

{

while($show=mysqli_fetch_assoc($res))

{

echo $show["docname"]."\n".$show["content"];

}

}

else {

echo "no content till now";

}

mysqli_close($con);

?>

6 0
3 years ago
The basic PowerPoint template has a simple presentation format with two text boxes, title and _____.
stiks02 [169]

Question: The basic PowerPoint template has a simple presentation format with two text boxes, title and ____

Answer: slide show

Explanation: this is the most logical answers because after all those steps in the presentation this is the next one


Question: The main reason many users have access to Outlook is to manage their e-mail communications and their

Answer: calendering

Explantion: this is used for messsaging and contacts and you also use it for to put important stuff on your calender

question answered by

(jacemorris04)

7 0
3 years ago
Read 2 more answers
Other questions:
  • When saving a memo you created in Word, which one of the following extensions is automatically assigned to the document?
    13·1 answer
  • What is the difference between an embedded image and an attached image
    7·2 answers
  • Google Ads was designed to deliver three things to every advertiser: relevance, control, and results. It provides relevance by c
    11·1 answer
  • Hi I am Khine Mye and I want to ask you a question I don't know that is square root of 2 is 1.4 and how to get that 1.4 and plz
    8·1 answer
  • An app where you spin a wheel for coins and exchange for giftcards
    6·1 answer
  • What are youth oraganizations?
    7·1 answer
  • Which statement pertaining to system reliability is FALSE? Select one: A. Having the latest version of software products can mak
    15·1 answer
  • Hi, I just have a few questions from my digital tech assignment.
    14·2 answers
  • Suppose that the host with IP address 10.0.1.19 sends an IP datagram destined to host 128.119.160.183. The source port is 3324,
    7·1 answer
  • consider a pipelined risc cpu with 14 stages. what is maximum speedup of this cpu over a non-pipelined implementation?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!