Skip to main content

Posts

Python Project With Source Code : Number Guessing

  Number Guessing  import random #bring in the random number import time number=random.randint(1, 200) #pick the number between 1 and 200   def intro():     print("May I ask you for your name?")     name=input() #asks for the name     print(name + ", we are going to play a game. I am thinking of a number between 1 and 200")     time.sleep(.5)     print("Go ahead. Guess!")   def pick():     guessesTaken = 0     while guessesTaken < 6: #if the number of guesses is less than 6         time.sleep(.25)         enter=input("Guess: ") #inserts the place to enter guess         try: #check if a number was entered             guess = int(enter) #stores the guess as an integer in...

Python Project with Source Code - Email Slicer

 Email Slicer :  email = input("Enter Your Email: ").strip()   username = email[:email.index('@')] domain = email[email.index('@') + 1:]   print(f"Your username is {username} & domain is {domain}") For execution and output so check the video :

Python project with Source Code - BMI Calculator

BMI Calculator  Height=float(input("Enter your height in centimeters: ")) Weight=float(input("Enter your Weight in Kg: ")) Height = Height/100 BMI=Weight/(Height*Height) print("your Body Mass Index is: ",BMI) if(BMI>0):                 if(BMI<=16):                                 print("you are severely underweight")                 elif(BMI<=18.5):                                 print("you are underweight")                 e...

Hackerrank Java Coding Questions and Answers - Maximum Passengers

  Hackerrank Java Coding Questions and Answers Maximum Passengers Problem Statement -:  A taxi can take multiple passengers to the railway station at the same time.On the way back to the starting point,the taxi driver may pick up additional passengers for his next trip to the airport.A map of passenger location has been created,represented as a square matrix. The Matrix is filled with cells,and each cell will have an initial value as follows: A value greater than or equal to zero represents a path. A value equal to 1 represents a passenger. A value equal to -1 represents an obstruction. The rules of motion of taxi are as follows: The Taxi driver starts at (0,0) and the railway station is at (n-1,n-1).Movement towards the railway station is right or down,through valid path cells. After reaching (n-1,n-1) the taxi driver travels back to (0,0) by travelling left or up through valid path cells. When passing through a path cell containing a passenger,the passe...

InfyTQ Python Coding Question & Answer 2022 - Team Division

  InfyTQ  Python Coding Question & Answer 2022 Team Division Problem Statement -:  Consider an array inarr containing at least two non-zero positive integers ranging between 1 to 300 (inclusive of the boundary values). Divide the integers in inarr into two groups based on the below rules: Each of the integers should belong to either of the two groups The total sum of integers in each of the groups must be as nearly equal as possible The total number of integers between the two groups should not differ by more than 1 Print, outnum1 and outnum2, the sum of the integers of two groups separated by a space. If outnum1 and outnum2 are not equal, then print the smaller sum followed by the larger sum. Input Format: Read the array inarr elements separated by (‘,’) comma. Read the input from the standard input stream. Output Format: Print outnum1 and outnum2 in the required order separated by a space. Print the output to the standard output stream. S...

InfyTQ Python Coding Question & Answer 2022 - Minimum Withdrawals

  InfyTQ  Python Coding Question & Answer 2022 Minimum Withdrawals Problem Statement-: There is a unique ATM in Wonderland. Imagine this ATM as an array of numbers. You can withdraw cash only from either ends of the array. Sarah wants to withdraw X amount of cash from the ATM. What is the minimum number of withdrawals Sarah would need to accumulate X amount of cash. If it is not possible for Sarah to withdraw X amount, return -1.  Input Format  The first line contains an integer, N, denoting the number of elements in ATM.  Each line i of the N subsequent lines (where 0 <= i < N) contains an integer describing the cash in the ATM.  The next line contains an integer, X, denoting the total amount to withdraw.  Constraints  1 <= N <= 10^5  1 <= ATM [i] <= 10^5  1 <= X <= 10^5  Sample Test Cases Sample Input 2 1 1 3  Sample Output -1  Explanation The total amount o...

InfyTQ Python Coding Question & Answer 2022 - Identify Palindrome

  InfyTQ  Python Coding Question & Answer 2022 Identify Palindrome Problem Statement-:  For a given positive number num, identify the palindrome formed by performing the following operations- Add num and its reverse  Check whether the sum is palindrome or not. If not, add the sum and its reverse and repeat the process until a palindrome is obtained  For example:  If original integer is 195, we get 9,339 as the resulting palindrome after the fourth addition:     195 + 591 ————–    786 + 687 ————–    1473 + 3741 ————–    5214 + 4125 ———-   9339 Input format:  Read num from the standard input stream.  Output format:  Print the palindrome calculated to the standard output stream.  Sample Test Cases Sample Input 1 124 Sample Output 1 545 Explanation 1 The sum of 124 and its reverse 421 is 545 which is a palindrome.  Sample i...