CBSE COMPUTER SCIENCE
رفتن به کانال در Telegram
QUESTION BANK, REFERENCE BOOK, LAB MANUAL , WORKSHEET ETC., PYTHON TEXT BOOK AND REFERENCE BOOKS, 01. ASK QUESTIONS AT https://t.me/joinchat/FJ1noGs-64I0OWI1
نمایش بیشتر549
مشترکین
اطلاعاتی وجود ندارد24 ساعت
اطلاعاتی وجود ندارد7 روز
اطلاعاتی وجود ندارد30 روز
آرشیو پست ها
>>>
==================== RESTART: C:/Users/MAHA/Desktop/Roots.py ===================
5 6 4
The roots are imaginary
>>>
==================== RESTART: C:/Users/MAHA/Desktop/Roots.py ===================
1 4 2
-1 -4
>>>
==================== RESTART: C:/Users/MAHA/Desktop/Roots.py ===================
1 4 4
-2 -2
>>>
==================== RESTART: C:/Users/MAHA/Desktop/Roots.py ===================
1 4 -4
0 -5
>>>
# importing math module
import math
A,B,C=map(int,input().split())
d=((B**2)-4*A*C)
if d>=0:
s=(-B+(d)**0.5)/(2*A)
p=(-B-(d)**0.5)/(2*A)
print(math.floor(s),math.floor(p))
else:
print('The roots are imaginary')
>>>
================== RESTART: C:/Users/MAHA/Desktop/Swapping.py ==================
Enter the value of x :28
Enter the value of y :67
Value of x: 67
Value of y: 28
Values SWAPPED
SWAPED THE VALUE WITHOUT USING THIRD VARIABLE
>>>
================== RESTART: C:/Users/MAHA/Desktop/Swapping.py ==================
Enter the value of x :345
Enter the value of y :987
Value of x: 987
Value of y: 345
Values SWAPPED
SWAPED THE VALUE WITHOUT USING THIRD VARIABLE
>>>
#Swapping two values without using third variable
x = int(input("Enter the value of x :"))
y = int(input("Enter the value of y :"))
(x,y) = (y,x)
print('Value of x: ', x, '\nValue of y: ', y, '\nValues SWAPPED')
print('SWAPED THE VALUE WITHOUT USING THIRD VARIABLE')
>>>
================== RESTART: C:/Users/MAHA/Desktop/TempConv.py ==================
Enter Celsius value : 35
35 degree celsius is equal to: 95.0 Fahrenheit
Enter Fahrenheit value : 75
75 Fahrenheit is equal to: 23.88888888888889 degree celsius
>>>
# Define a function to convert
# celsius temperature to Fahrenheit
def Celsius_to_Fahrenheit(c) :
f = (9/5)*c + 32
return f
# Define a function to convert
# Fahrenheit temperature to Celsius
def Fahrenheit_to_Celsius(f) :
c = (5/9)*(f - 32)
return c
# Driver Code
if name == "main" :
c = int(input("Enter Celsius value : "))
print(c, "degree celsius is equal to:",Celsius_to_Fahrenheit(c),"Fahrenheit")
f = int(input("Enter Fahrenheit value : "))
print(f,"Fahrenheit is equal to:",Fahrenheit_to_Celsius(f),"degree celsius")
output: >>>
=============== RESTART: C:/Users/MAHA/Desktop/SimpleInterest.py ===============
Enter the principle amount : 1000
Enter the rate of interest : 5
Enter the time in the years: 3
Principle amount: 1000.0
Interest rate : 5.0
Time in years : 3.0
Simple Interest : 150.0
>>>
=============== RESTART: C:/Users/MAHA/Desktop/SimpleInterest.py ===============
Enter the principle amount : 35000
Enter the rate of interest : 7
Enter the time in the years: 4
Principle amount: 35000.0
Interest rate : 7.0
Time in years : 4.0
Simple Interest : 9800.0
>>>
# Python program to find simple interest
p = float(input("Enter the principle amount : "))
r = float(input("Enter the rate of interest : "))
t = float(input("Enter the time in the years: "))
# calculating simple interest
si = (p*r*t)/100
# printing the values
print("Principle amount: ", p)
print("Interest rate : ", r)
print("Time in years : ", t)
print("Simple Interest : ", si)
