Python Answers

Questions answered by Experts: 5 288

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

make an algorithm using pseudocode and python which will get atm pin code from user. if the pin is "1234" then it should display correct otherwise if the pin is incorrect 3 times it should display account locked



Convert list [""python"", ""is"", ""a"", ""programming"", ""language""] into string"

"python is a programming language""


second Problem


a= "python is a programming language"

expected output:- {"python"=6, "is"=2,a""=1,"programing"=11, "language"=8}


Create program that requires the user to enter the following data, name, grade in 9 subjects, compute the general weighted average, inform the user if the average pass or fail, ask the user to try again the program Y for yes and will iterate the program value not y displays the message Thank You
Make an algorithm using pseudocode and python which will get ATM pinhole from user, if the pin is 1234 display correct otherwise if the pin is incorrect 3 times display account locked.


W pattern with *

Write a program to print

W pattern of N lines using an asterisk(*) character as shown below.Note: There is a space after each asterisk * character.Input

The first line is an integer

N.Explanation

For

N = 5The output should be



#using python3

# The client Sends All Data to server and then Closes the Connection,

#without expecting reply.

# Using UDP datagrams for communication, then the protocol itself will

#deliver your data in discrete and identifiable chunks.

# Sending data over a stream but delimited as length-prefixed blocks.


import socket, struct

from argparse import ArgumentParser


header_struct = struct.Struct('!I') # messages up to 2**32 - 1 in length

def client(address):

   sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

   sock.connect(address)

   sock.shutdown(socket.SHUT_RD)

   put_block(sock, b'Beautiful is better than ugly.')

   put_block(sock, b'Explicit is better than implicit.')

   put_block(sock, b'Simple is better than complex.')

   put_block(sock, b'')

   sock.close()


Shaded Diamond

Given an integer value 

N as input, write a program to print a shaded diamond of 2*N -1 rows using an asterisk(*) character as shown below.

Note: There is a space after each asterisk (*) character.

Input

The first line of input is an integer 

N.

Explanation

In the given example 

N = 5. Therefore, the output should be

    * 
   * * 
  * * * 
 * * * * 
* * * * * 
 *     *
  *   *
   * *
    *
Sample Input 1
6
Sample Output 1
     * 
    * * 
   * * * 
  * * * * 
 * * * * * 
* * * * * * 
 *       *
  *     *
   *   *
    * *
     *
Sample Input 2
5
Sample Output 2
    * 
   * * 
  * * * 
 * * * * 
* * * * * 
 *     *
  *   *
   * *
    *

Number Diamond

Given an integer 

N as input, write a program to print a number diamond of 2*N -1 rows as shown below.

Note: There is a space after each number.

Input

The first line of input is an integer 

N.

Explanation

In the given example, the number of rows in the diamond is 

5.

So, the output should be

    1 
   1 2 
  1 2 3 
 1 2 3 4 
1 2 3 4 5 
 1 2 3 4 
  1 2 3 
   1 2 
    1
Sample Input 1
5
Sample Output 1
    1 
   1 2 
  1 2 3 
 1 2 3 4 
1 2 3 4 5 
 1 2 3 4 
  1 2 3 
   1 2 
    1
Sample Input 2
4
Sample Output 2
   1 
  1 2 
 1 2 3 
1 2 3 4 
 1 2 3 
  1 2 
   1

Multiples of 3

You are given 

N inputs. Print the numbers that are multiples of 3.

Input

The first line of input is an integer 

N. The next N lines each contain an integer as input.

Explanation

In the given example, there are 

6 inputs. 1, 2, 3, 5, 9, 6. The numbers 3, 9, 6 are multiples of 3.

So, the output should be 

3
9
6
Sample Input 1
6
1
2
3
5
9
6
Sample Output 1
3
9
6
Sample Input 2
4
1
3
6
8
Sample Output 2
3
6

Multiple of 5

You are given 

N inputs. Print the given inputs until you encounter a multiple of 5.

Input

The first line of input is an integer 

N. The next N lines each contain an integer as input.

Explanation

In the given example, there are 

6 inputs. 1, 2, 3, 5, 9, 6

After 

3, we have encountered 5, which is a multiple of 5.

So, the output should be 

1
2
3
Sample Input 1
6
1
2
3
5
9
6
Sample Output 1
1
2
3
Sample Input 2
5
1
2
3
4
5
Sample Output 2
1
2
3
4

LATEST TUTORIALS
APPROVED BY CLIENTS