Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 73fec35

Browse files
Code
1 parent 76421a3 commit 73fec35

15 files changed

+148
-0
lines changed

‎Comma_Separated_Sequence.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Write a Python Program to find numbers between 100 and 400 (both included) where each digit of a number is an even number. the numbers obtained should be printed in a comma-separated sequence.
2+
items = []
3+
for i in range(100, 401):
4+
s = str(i)
5+
if (int (s[0]) % 2 == 0) and (int (s[1]) % 2 == 0) and (int (s[2]) % 2 == 0):
6+
items.append(s)
7+
print(",".join(items))

‎Convert_Temperatures.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Write a Python Program to Convert Temperatures to and from Celsius, Fahrenheit.
2+
3+
# Formula: c = (5/9)*(F-32)
4+
temp = input("Input the Temperature You Like to Convert? (Ex: 45F, 102C Etc.): ")
5+
degree = int(temp[:-1])
6+
i_convention = temp[-1]
7+
8+
if i_convention.upper() == "C":
9+
result = int(round((9 * degree) / 5 + 32))
10+
o_convention = "Fahrenheit"
11+
elif i_convention.upper() == "F":
12+
result = int(round((degree - 32) * 5 / 9))
13+
o_convention = "Celsius"
14+
else:
15+
print("Input Proper Convention.")
16+
quit()
17+
print("The Temperature in", o_convention, "is", result, "Degrees.")

‎Corresponding_Type.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Write a Python Program that prints each item and its corresponding type from the following list.
2+
3+
datalist = [2706, 27.00, 1+2j, True, 'Sagar', (27, 2001), [27, 2001], {"Course":'BCA', "Section":'A'}]
4+
for item in datalist:
5+
print("Type of ", item, " is ", type(item))
6+

‎Divisible_&_Multiplication.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Write a Python Program to find those numbers which are divisible by 7 and multiple of 5, between 1500 and 2700 (both included).
2+
3+
n1 = []
4+
for x in range(1500, 2701):
5+
if (x%7==0) and (x%5==0):
6+
n1.append(str(x))
7+
print(','.join(n1))

‎Even_Odd_Count_Number.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Write a Python Program to Count the Number of Even and Odd Numbers from a Series of Numbers.
2+
number = (1, 2, 3, 4, 5, 6, 7, 8, 9) # Declaring the Tuple
3+
count_odd = 0
4+
count_even = 0
5+
for x in number:
6+
if not x % 2:
7+
count_even+=1
8+
else:
9+
count_odd+=1
10+
print("Number of Even Numbers: ", count_even)
11+
print("Number of Odd Numbers: ", count_odd)

‎Except.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Write a Python Program that prints all the numbers from 0 to 6 except 3 and 6.
2+
for x in range(6):
3+
if (x == 3 or x == 6):
4+
continue
5+
print(x, end=' ')
6+
print("\n")

‎Fibonacci_Series.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Write a Python program to get the fibonacci series between 0 to 50.
2+
x,y = 0,1
3+
while y<100:
4+
print(y)
5+
x,y = y,x+y

‎FizzBuzz.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
''' Write a Python program which iterates the integers from 1 to 50. for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". for numbers which are multiples of both three and five print "FizzBuzz". '''
2+
for fizzbuzz in range(51):
3+
if fizzbuzz % 3 == 0 and fizzbuzz % 5 == 0:
4+
print("FizzBuzz")
5+
continue
6+
elif fizzbuzz % 3 == 0:
7+
print("fizz")
8+
continue
9+
elif fizzbuzz % 5 == 0:
10+
print("buzz")
11+
continue
12+
print(fizzbuzz)
13+

‎Generate_Array.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Write a Python program which takes two digits m(row) and n(column) as input and generates a two-dimensional array. the element value in the i-th and j-th column of the array should be i*j.
2+
row_num = int(input("Input Number of Rows: "))
3+
col_num = int(input("Input Number of Columns: "))
4+
multi_list = [[0 for col in range(col_num)] for row in range(row_num)]
5+
6+
for row in range(row_num):
7+
for col in range(col_num):
8+
multi_list[row][col]= row*col
9+
10+
print(multi_list)

‎Guess_Number.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Write a Python Program to Guess a Number Between 1 to 9.
2+
import random
3+
target_num, guess_num = random.randint(1, 10), 0
4+
while target_num != guess_num:
5+
guess_num = int(input('Guess a number between 1 and 10 until you get it right: '))
6+
print('Well Guessed!')

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /