filmov
tv
Absolute Beginners Codekata Program Solving using Python (16 - 30)

Показать описание
Hey guys, Welcome to FORMAL INFINITY Channel, In this video we would discuss the solution for Codekata programing problems using python in Guvi. In this specific video we have discussed Input and Output related problems in Guvi. We would continue this series of video for covering all the topics under codekata.
If you find our videos useful, please like or comment and don't forget to subscribe our channel to follow frequent videos and regular updates posted in our channel.
And If you haven't checked Playlists available in our channel, The link for all the available playlists is given below:
If you have any queries related to problem solving (or) encounter difficulties while coding in Python, You may contact me through Gmail.
_________________
Question_1:-
Using the method of looping, write a program to print the table of 9 till N in the format as follows:
(N is input by the user)
9 18 27...
Print NULL if 0 is input
Sample Input :
3
Sample Output :
9 18 27
******************
N = int(input())
arr = []
for i in range(1,N+1):
print(*arr)
_________________
Question_2:-
Write a code to get an integer N and print the sum of values from 1 to N.
Sample Input :
10
Sample Output :
55
*****************
a = int(input())
k = 0
for i in range(1,a+1):
k += I
print(k)
_________________
Question_3:-
Write a code to get 2 integers A and N. Print the integer A, N times in separate line.
*****************
A, N = map(int,input().split())
for i in range(N):
print(A)
_________________
Question_4:-
You are provided with the radius of a circle "A". Find the length of its circumference.
Sample Input :
2
Sample Output :
12.57
******************
A = float(input())
C = 2*(22*A)
D = C/7
print(round(D,2))
_________________
Question_5:-
Write a code get an integer number as input and print the sum of the digits.
******************
n = int(input())
r = 0
while n 'use grater than sign' 0:
d = n%10
r = r+d
n = n//10
print(r)
_________________
Question_6:-
Write a code to get an integer N and print the values from N to 1.
*******************
num = int(input())
for i in range(num,0,-1):
print(i)
_________________
Question_8:-
Write a program to get a string as input and reverse the string without using temporary variable.
******************
a = input()
print(a[::-1])
_________________
Question_9:-
Write a code to get an integer N and print the even values from 1 till N in a separate line.
******************
num = int(input())
for i in range(1, num+1):
if i % 2 == 0:
print(i)
_________________
Question_10:-
Write a code to get an integer N and print values from 1 till N in a separate line.
******************
num = int(input())
for i in range(1, num+1):
print(i)
_________________
Question_11:-
Print the First 3 multiples of the given number "N". (N is a positive integer)
Note: print the characters with a single space between them.
******************
N = int(input())
print(N,N*2,N*3)
_________________
Question_12:-
You are given with Principle amount($), Interest Rate(%) and Time (years) in that order. Find Simple Interest.
Print the output up to two decimal places (Round-off if necessary).
(S.I. = P*T*R/100)
******************
P,T,R = map(float,input().split(' '))
A = P*T*R
B = A/100
print(round(B,2))
_________________
Question_13:-
You are provided with two numbers. Find and print the smaller number.
Input Description:
You are provided with two numbers as input.
Output Description:
Print the small number out of the two numbers.
Sample Input :
23 1
Sample Output :
1
*****************
arr = list(map(int,input().split()))
print(min(arr))
_________________
Question_14:-
Write a code to get an integer N and print the digits of the integer.
Sample Input :
348
Sample Output :
3 4 8
*****************
a = input()
arr = []
for i in a:
print(*arr)
_________________
Question_15:-
Write a code to get 2 integers as input and find the HCF of the 2 integer without using recursion or Euclidean algorithm.
Input Description:
A single line containing 2 integers separated by space.
Output Description:
Print the HCF of the integers.
Sample Input :
2 3
Sample Output :
1
******************
A,B = map(int,input().split())
hcf = 1
if A 'use grater than sign' B:
c = B
else:
c = A
for i in range(1, c+1):
if (A % i == 0) and (B % i == 0):
hcf = I
print(hcf)
******************
If you find our videos useful, please like or comment and don't forget to subscribe our channel to follow frequent videos and regular updates posted in our channel.
And If you haven't checked Playlists available in our channel, The link for all the available playlists is given below:
If you have any queries related to problem solving (or) encounter difficulties while coding in Python, You may contact me through Gmail.
_________________
Question_1:-
Using the method of looping, write a program to print the table of 9 till N in the format as follows:
(N is input by the user)
9 18 27...
Print NULL if 0 is input
Sample Input :
3
Sample Output :
9 18 27
******************
N = int(input())
arr = []
for i in range(1,N+1):
print(*arr)
_________________
Question_2:-
Write a code to get an integer N and print the sum of values from 1 to N.
Sample Input :
10
Sample Output :
55
*****************
a = int(input())
k = 0
for i in range(1,a+1):
k += I
print(k)
_________________
Question_3:-
Write a code to get 2 integers A and N. Print the integer A, N times in separate line.
*****************
A, N = map(int,input().split())
for i in range(N):
print(A)
_________________
Question_4:-
You are provided with the radius of a circle "A". Find the length of its circumference.
Sample Input :
2
Sample Output :
12.57
******************
A = float(input())
C = 2*(22*A)
D = C/7
print(round(D,2))
_________________
Question_5:-
Write a code get an integer number as input and print the sum of the digits.
******************
n = int(input())
r = 0
while n 'use grater than sign' 0:
d = n%10
r = r+d
n = n//10
print(r)
_________________
Question_6:-
Write a code to get an integer N and print the values from N to 1.
*******************
num = int(input())
for i in range(num,0,-1):
print(i)
_________________
Question_8:-
Write a program to get a string as input and reverse the string without using temporary variable.
******************
a = input()
print(a[::-1])
_________________
Question_9:-
Write a code to get an integer N and print the even values from 1 till N in a separate line.
******************
num = int(input())
for i in range(1, num+1):
if i % 2 == 0:
print(i)
_________________
Question_10:-
Write a code to get an integer N and print values from 1 till N in a separate line.
******************
num = int(input())
for i in range(1, num+1):
print(i)
_________________
Question_11:-
Print the First 3 multiples of the given number "N". (N is a positive integer)
Note: print the characters with a single space between them.
******************
N = int(input())
print(N,N*2,N*3)
_________________
Question_12:-
You are given with Principle amount($), Interest Rate(%) and Time (years) in that order. Find Simple Interest.
Print the output up to two decimal places (Round-off if necessary).
(S.I. = P*T*R/100)
******************
P,T,R = map(float,input().split(' '))
A = P*T*R
B = A/100
print(round(B,2))
_________________
Question_13:-
You are provided with two numbers. Find and print the smaller number.
Input Description:
You are provided with two numbers as input.
Output Description:
Print the small number out of the two numbers.
Sample Input :
23 1
Sample Output :
1
*****************
arr = list(map(int,input().split()))
print(min(arr))
_________________
Question_14:-
Write a code to get an integer N and print the digits of the integer.
Sample Input :
348
Sample Output :
3 4 8
*****************
a = input()
arr = []
for i in a:
print(*arr)
_________________
Question_15:-
Write a code to get 2 integers as input and find the HCF of the 2 integer without using recursion or Euclidean algorithm.
Input Description:
A single line containing 2 integers separated by space.
Output Description:
Print the HCF of the integers.
Sample Input :
2 3
Sample Output :
1
******************
A,B = map(int,input().split())
hcf = 1
if A 'use grater than sign' B:
c = B
else:
c = A
for i in range(1, c+1):
if (A % i == 0) and (B % i == 0):
hcf = I
print(hcf)
******************
Комментарии