Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Creating a user-registration interface that implements character checks, range checks and email verification. In the blank trinket given below, write a program to get the

Creating a user-registration interface that implements character checks, range checks and email verification.

In the blank trinket given below, write a program to get the username of a user for registering to a social networking website. A valid username contains lower-case letters only. Upper case letters, special characters and numbers are not allowed. If an invalid username is entered, print an error message, and ask the user to re-enter a valid username. [ASCII code of a=97 and ASCII code of z=123].

This social networking website allows only users of age 18 years to 60 years to register. If the username entered is valid, include statements to validate the age of the user.

When an invalid age is entered, print Sorry, invalid age!. If a valid age is entered, print, Age accepted.

If the user is of valid age, allow the user to enter their email address. Include statements to verify email address. They should be asked to enter their email address again. If this matches with the first entry, print a message stating that the user registration is complete. Otherwise, the user is asked to start over (make the first entry for the email address).

Implementing presence checks, length checks and format checks.

In the blank trinket file, write a program to prompt users to enter their name. Write a program to make sure that name is not left blank. If the name is blank, ask the user to enter a name.

In the same file, include statements for the user to enter password. The password must be of at least 10 characters. If the user enters a valid password, print password accepted. Otherwise, ask the user to enter a valid password.

In the same file, include statements for the user to enter date of birth. The date entered must be in the format dd/mm/yy. If the user enters a valid date, print Registration accepted. Otherwise, ask the user to enter a valid date of birth.

Implementing type checks.

In the blank trinket given below, write a program that receives two integers from users and calculates their product. Using eval() function, evaluate the type of numbers entered. If the user does not enter valid integers, print an error message, and ask them to re-enter valid integers.

If the user enters valid integers, print the product of two numbers.

In the blank trinket given below, implement the program in (i) using a try-except block.

Format checks using regular expressions.

Using regular expressions, validate userID entered by a user. userID consists of 2 or 3 uppercase letters followed by 5 numbers. If the user enters a valid userID, print, userID accepted. Otherwise, print an error message and ask the user to re-enter userID.

If the userID is accepted, ask the user to enter a password. The password entered must have:

At least have 8 characters

At least one uppercase letter

At least one lower case letter

At least one number

At least one special character like @, $, %, etc

Must contain less than 18 characters

Extend the program in (i) to validate the password. If the password entered is invalid, ask the user to enter a valid password.

[Hint: Use search() function]

Implementing check digit validation.

International Standard Book Number (ISBN) is a 13-digit number. It consists of 12 digits and a check digit. The check digit is calculated by:

Taking the first 12 digits.

Starting from the left side of the number, multiply each digit alternatively by 1 and 3. The first digit is multiplied by 1 and the second digit is multiplied by 3 and so on.

Find the sum of the values obtained in step b.

Do a modulo 10 division on the result from step c.

Take the remainder from step d. If its 0, the check digit is 0. Otherwise, subtract the remainder from 10 to obtain the check digit.

Write a program to validate the ISBN number entered by the user.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899

Students also viewed these Databases questions