Generate a DNA string of "ATGCN" of length at most 2048 bases (characters) using
your own random function and store it into a text file.
# compute number of boxes for given number of books
box_height = 10.5
book_thickness = 1.2
# compute the number of books per standard box. Convert the result to an integer type
books_per_box = 8
# now ask the user for the number of books the customer ordered
books_ordered = int(input("books_ordered: "))
# compute the number of boxes needed. Store it in the variable called "num_boxes"
num_boxes = books_ordered/8
# compute how many books are left over, and then print the final message.
1. Create a class BankAccount, the __init__ (self, pin) method should initialize the balance as 0 and pin as “pin”.
2. Create method name deposit (self, pin, amount), which takes 2 arguments, pin and amount. Method should increment account balance by amount and return new balance.
3. Create method name withdraw (self, pin, amount), which takes 2 arguments, pin and amount. Method should decrement the account balance by amount and return new balance. When user try to withdraw the amount more than the amount in the account then It should display the message “Not sufficient balance”.
4. Create method get_balance(self, pin), this method should return account balance.
5. Create method change_pin(self, old_pin, new_pin), should change the account pin
6. If user try to enter the amount with the wrong pin program should display the “Wrong Pin” error message.
7. Create two instances of the BankAccount and call all the methods.
Create a class Emp with 3 instance variables named: emp_id, emp_name and pay. In this, emp_id and emp_name are the strings and pay data type is a float. This class also has a member function ‘total_salary()’ – this method will compute the total salary of employees.
The total salary should be sum of all allowances using:
Sample Input:
Enter the employee id:1
Enter the employee name: Bob
Enter the pay:2000
Sample Output:
Employee Id: 1 , Employee Name: Bob, Total Salary:2260.00
write a program that generates and prints 50 random integers, each about 3 and 6.
You are given a list of urls. You need to extract the domain name from the
urls in another list. Also you need to extract the ending string which the
url ends with.
For example, ‘https://www.example.com/market.php’ -- In this example, domain
name is ‘www.example.com’ and the ending string is ‘php’
url_list = ['https://blog.hubspot.com/marketing/parts-url',
'https://www.almabetter.com/enrollments',
'https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.rename.html',
'https://www.programiz.com/python-programming/list']
Next create a pandas dataframe with the above three lists.
There are N people in a party numbered 1 to N. Sruthi has K cards with her. Starting with person A, she gives the cards one by one to the people in the party in the numbering order: A, A+1, A+2, . .., N, 1, 2,..., A-1. Your task is to output the number of the person who will get the last card.
Input:
The only line of input contains space separated integers N, K and A.
Output:
print the number representing the person who will get the last card.
Explanation:
Given N=3, K=3 and A=2.
Distribution of cards starts from 2. The final order of person is 2,3,1.
The last person to get the card is 1.
Sample Input 1:
3 3 2
Sample Output 1:
1
Sample Input 2:
1 100 1
Sample Output 2:
1
SPECIAL NUMBERS
you only like numbers that start with an odd digit. anil gives you space-separated integers as input . your task is left-rotate every number in the list (if required) so that can be liked by you.
NOTE:
if there is no odd digit in the number , do not rotate it.
if a number starts with an odd digit , do not rotate it
INPUT :
The first line of the input contains space-separated integers
OUTPUT:
The out should be a single line containing space separated integers with odd digit as first digit for each number.
EXPLANATION:
in the example, input is 21, 503, 256, 550, 86, 979, 281
Rotate all the words to the left so that each number starts with an odd digit .
Input1: 21 503 256 550 86 979 281
Output 1: 12 503 562 550 86 979 128
Input 2: 2001 463 6219 669 473 1006 77734 110 20511
Output 2: 1200 346 1962 966 734 1006 77734 110 511120
The Richest person
Input:
4
Jonncena 10000
Jane 2000
Jack 4000
Tom 4000
Output:
Jack 2
given a sentence write a program rotate all the words left so that every word starts with a vowel.
note: if there is no vowel in the word do not rotate it.
sample input:
I saw a DRAGON flying in the sky
sample output:
I aws a AGONDR ingfly in eth sky