For the database connection, use the following connection string variables: database = sys.argv[1] //name of the databas

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

For the database connection, use the following connection string variables: database = sys.argv[1] //name of the databas

Post by answerhappygod »

For the database connection, use the following connection string
variables:
database = sys.argv[1] //name of the database is obtained from
the command line argument
user = os.environ.get('PGUSER')
password = os.environ.get('PGPASSWORD')
host = os.environ.get('PGHOST')
port = os.environ.get('PGPORT')
Problem Statement:
Write a Python program to print the ISBN numbers of books which
are published in a given year. Here, the year is obtained as the
value of function L(x) (given after the sample output) at x. You
have to read the value of x from the input file
"number.txt", and use it to find the value of
L(x). Your program must assume that the file
number.txt resides in the same folder as your
Python program.
You have to iterate through the list and print each value
separately as shown in the output below:
9789352921171
9789351343202
9789353333380
The line function is given below:
L4(x) = 2000 + 4*x + 4
Note: Do not hard code the database name in your program,
because your program will be run against a different database
instance for evaluation.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply