Vous êtes sur la page 1sur 5

Feedback ->

https://goo.gl/forms/bnRPc9GQfeMAgBYo1
All help in finding the solutions will be given, but solutions wont be given. By just
giving solutions, problem solving skills wont get developed.

Variables
Int, Float, Bool, String data-types and +, -, *, /, **, // operators. Find which operations
with which data types have errors.

Take two integers input from user and print its average.
Take two strings input from user and print its concatenation.

Take integer string, float string and character string and convert each to int.

Control Flow
If Else
Take student marks of three subjects and print the grade by percentage.
If percentage is < 40 then fail,
less than 70 B grade,
less than 90, A grade.

Take student marks of three subjects and print the grade by percentage.
If less than 90, A grade,
less than 70 B grade,
less than 40 then fail.

Take input from user. Check whether integer , rational number, natural number or
complex number.

Loops
Print multiplication table of number given by user.

Print factorial of a number. n! = n * n - 1 * n - 2 ... * 3 * 2 * 1

Find sum of first n numbers from 1, 2 to n using for loop & using while loop
Without using ** function for power,
calculate value of m ** n using for loop and while loop

Print first 100 elements of series. 0, 1, 3, 6, 10, 15, 21, 28 and so on


Find a 4 digit number when multiplied by 4, result is reverse of original number
Find number ABCD for which
ABCD
*4=
DCBA

Strings
https://docs.python.org/3/library/stdtypes.html#string-methods
Imp Methods
count()
startswith(), endswith()
find() , rfind()
index(), rindex()
replace()
isdigit(), isnumeric()
strip(), lstrip(), rstrip()
partition(), rpartition()
split()
in

var1 = good morning


Print the string in reverse.
Print the string in order by skipping every alternate character
Print the string in reverse by skipping every alternate character

First 5 characters of a string


Last 5 characters of a string
All but last 5 characters of a string
All but first 5 characters of a string
Print string in reverse
Print alternate characters in a string
Print alternate characters in reverse in a string
Print 5th character from the beginning
Print 5th character from the end

var1 = a very long string to print. Too big for a normal indexing to work on
Print substring of following indexes 0 , 2 , 4, 6 , 8 , 10 and so on
Print substring of following indexes 0, 1, 3, 6, 10, 15, 21, 28 and so on

var1 = hello world how are you


Divide string into half and print the second half of the string

var1 = one two one three one four one five one six
Extract substring between third occurrence of one & fourth occurrence of one
Find all indexes of occurences of string one

var1 = good morning everyone, welcome to python programming


Print the string one character at a time.
Print the string one word at a time
Separate the string by , and print each section

Version Control
https://github.com/ajinkyakolhe112/github_demo

Terms:
Commit
Push
Fork
Pull
Pull Request

Data Structures
https://docs.python.org/3/tutorial/datastructures.html
List Functions:
Append
Extend
Insert
Remove
Pop
Count
Reverse
Sort

Create multiplication table of a number, the multiplication table is saved in a list

Create multiplication table of all 1 to 30 numbers. Saved as list inside list

Remove all duplicate elements of a list

Create a n * n matrix of integers as list of lists. Print its transpose.

Value or Reference

Problem Solving
Prime Numbers
Check if a number is prime or not
Print all prime factors of any number
Print all prime numbers in first 1000 numbers.
1st prime number is 2
2nd prime number is 3
3rd prime number is 5
Similarly find nth prime number by taking n as input from user
Some prime numbers can be expressed as Sum of other consecutive prime
numbers.
For example
5=2+3
17 = 2 + 3 + 5 + 7
41 = 2 + 3 + 5 + 7 + 11 + 13
Your task is to find out how many prime numbers which satisfy this property
are present in the range 3 to N subject to a constraint that summation should
always start with number 2.
Write code to find out number of prime numbers that satisfy the above
mentioned property in a given range.
Some prime numbers can be expressed as Sum of other consecutive prime
numbers.
For example
5=2+3
17 = 2 + 3 + 5 + 7
41 = 2 + 3 + 5 + 7 + 11 + 13
Your task is to find out how many prime numbers which satisfy this property
are present in the range 3 to N subject. Summation can start with any prime
number.
Write code to find out number of prime numbers that satisfy the above
mentioned property in a given range.

Compare two anagram strings for equality

Frog Jumping
You have an array of integers and have a frog at the first position
[Frog, int, int, int, ..., int]
The integer itself may tell you the length and the direction of the jump
For instance:
2 = jump two indices to the right
-3 = jump three indices to the left
0 = stay at the same position
Your objective is to find how many jumps are needed to jump out of the array.
Return -1 if Frog can't jump out of the array
Example:
array = [1, 2, 1, 5];
jumps = 3 (1 -> 2 -> 5 -> <jump out>)

Josephs Problem
There are n people standing in a circle waiting to be executed. The counting out
begins from person number 1 in the circle and proceeds around the circle in a fixed
direction. In each step, a certain number of people are skipped and the next person
is executed. The elimination proceeds around the circle (which is becoming smaller
and smaller as the executed people are removed), until only the last person remains,
who is given freedom. Given the total number of persons n and a number k which
indicates that k-1 persons are skipped and kth person is killed in circle. The task is to
find the person number which survives.
For example, if n = 5 and k = 2, then the person 3 survives. Firstly, the person at
position 2 is killed, then person at position 4 is killed, then person at position 1 is
killed. Finally, the person at position 5 is killed. So the person at position 3 survives.
If n = 7 and k = 3, then the safe position is 4. The persons at positions 3, 6, 2, 7, 5, 1
are killed in order, and person at position 4 survives.