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
trapecia [35]
2 years ago
5

Need some help writing a simple PYTHON Student registration program:

Computers and Technology
1 answer:
Y_Kistochka [10]2 years ago
6 0

import random

database = {}

while True:

   try:

       user_choice = int(input("Enter your student id to bring up your information (Press enter if you don't have one) : "))

       if user_choice in database:

           print("Student ID:",database[user_choice][0],"\nFirst name:",database[user_choice][1],"\nLast name:",database[user_choice][2],"\nPhone number:",database[user_choice][3],"\nEmail address:",database[user_choice][4],"\nPassword:",database[user_choice][5],"\nPoints:",database[user_choice][6])

   except ValueError:

       name = input("Enter your first name: ")

       last_name = input("Enter your last name: ")

       phone_number = input("Enter your phone number: ")

       email = input("Enter your email address: ")

       password = input("Enter a password: ")

       points = 100

       student_id = random.randint(1,1000)

       while student_id in database:

           student_id = random.randint(1,1000)

       print("Hello,",name,"your student ID is:",student_id)

       database[student_id] = [student_id,name, last_name, phone_number, email, password, points]

I wrote my code in python 3.8. I hope this helps.

You might be interested in
Implementing an interface means that you are adding to your class any mechanisms defined in an abstract class. Your class essent
rodikova [14]

Answer:

The answer is "True"

Explanation:

The information, that is true or false in the statement is missing, which can be defined as follows:

  • The interface is a part of the Java programming language, which offers you to achieve multiple inheritances. It is also known as a common limit, that exchanges information on two or more separate parts of a computer network.  
  • It also contains the abstract method, and an interface to interface inheritance it uses extends keyword, and in the interface to a class, it uses the implement keyword.
3 0
3 years ago
Which is the primary use of a word processor? create, edit, format, and print text-based documents maintain a database of record
qaws [65]
<span>Which is the primary use of a word processor? 
</span>
create, edit, format, and print text-based documents

------------------------------------------------------------------------------------------------

Hope This Helps :)

P.S
If you could mark me as brainiest that would be great! :D
3 0
2 years ago
What is the FICO system?
Serhud [2]
It is C) A credit investment system.
8 0
3 years ago
Question 3 (2 points)
jeyben [28]

Answer:

The energy source that does not use heat in the process of converting it to electricity is;

c. Sunlight

Explanation:

In converting Sunlight energy source to electricity, the photons in the light from the Sun excite electrons in the solar cells silicon layers, such that the electrons travel from n-type silicon layer to the p-type silicon layer creating electric potential energy that does work as the electrons flow back in the form of electricity from the p-type to the n-type silicon layer through an external circuit

7 0
2 years ago
Assume inputFile is a Scanner object used to read data from a text file that contains a number of lines. Each line contains an a
anzhelika [568]

Answer:

words.hasNext()

Explanation:

Given the code snippet below:

  1.        while (inputFile.hasNextLine()) {
  2.            String word = "";
  3.            String line = inputFile.nextLine();
  4.            Scanner words = new Scanner(line);
  5.            while (words.hasNext()) {
  6.                word = words.next();
  7.            }
  8.            System.out.println(word); }
  9.    }

We have a inputFile Scanner object that can read data from a text file and we presume the inputFile has read several rows of data from the text file. So long as there is another line of input data available, the outer while loop will keep running. In each outer loop, one line of data will be read and assign to line variable (Line 3). Next, there is another Scanner object, words, which will take the current line of data as input. To get the last word of that line, we can use hasNext() method. This method will always return true if there is another tokens in its input. So the inner while loop will keep running so long as there is a token in current line of data and assign the current token to word variable. The word will hold the last token of current line of data upon exit from the inner loop. Then we can print the output (Line 8) which is the last word of the current line of data.

7 0
3 years ago
Other questions:
  • Show what this program prints. Be exact and complete. Can you explain the behavior of each print statement? 1 2 3 4 5 6 7 public
    12·1 answer
  • The prediction that the number of transistors on a chip would double about every two years is known as ________. Metcalfe's law
    6·1 answer
  • A firewall, when properly implemented, can prevent most attacks on your system.
    11·1 answer
  • In order to average together values that match two different conditions in different ranges, an Excel user should use the functi
    6·1 answer
  • A browser is used for creating Web pages. true or false?
    5·2 answers
  • Examine the following code.
    9·1 answer
  • Describe the difference between a myth and a fable.
    12·1 answer
  • What is an Operating System ??
    7·1 answer
  • How to use access?<br> like working in access and bringing tables and stuff
    5·1 answer
  • 7.2.4 Area of Triangle HELP PLEASE!! (JAVA SCRIPT) I WILL WAIT FOR THE SOLUTION.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!