Upload files to "basic programming/1st task"
This commit is contained in:
11
basic programming/1st task/1.py
Normal file
11
basic programming/1st task/1.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Q1
|
||||||
|
|
||||||
|
# Imports
|
||||||
|
import math
|
||||||
|
|
||||||
|
# Get values from user
|
||||||
|
radius = int(input("Enter radius: "))
|
||||||
|
circumference = (2 * math.pi)*radius
|
||||||
|
|
||||||
|
# Print circumference value
|
||||||
|
print(f"Circle Circumference is {circumference}.")
|
||||||
17
basic programming/1st task/2.py
Normal file
17
basic programming/1st task/2.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Q2
|
||||||
|
|
||||||
|
# Imports
|
||||||
|
import math
|
||||||
|
|
||||||
|
# Get values from user
|
||||||
|
num1 = int(input("Enter first number: "))
|
||||||
|
num2 = int(input("Enter second number: "))
|
||||||
|
num3 = int(input("Enter third number: "))
|
||||||
|
|
||||||
|
# Calculate values
|
||||||
|
number_sum = num1 + num2 + num3
|
||||||
|
average = number_sum/3
|
||||||
|
|
||||||
|
# Print values
|
||||||
|
print(f"Sum is {number_sum}.")
|
||||||
|
print(f"Average is {average}.")
|
||||||
12
basic programming/1st task/3.py
Normal file
12
basic programming/1st task/3.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# Q3
|
||||||
|
|
||||||
|
# Get values from user
|
||||||
|
num1 = int(input("Enter first number: "))
|
||||||
|
num2 = int(input("Enter second number: "))
|
||||||
|
|
||||||
|
# Calculate values
|
||||||
|
result = int(num1/num2)
|
||||||
|
remainder = num1%num2
|
||||||
|
|
||||||
|
# Print values
|
||||||
|
print(f"The result is {result}, and the remainder is {remainder}.")
|
||||||
14
basic programming/1st task/4.py
Normal file
14
basic programming/1st task/4.py
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Q4
|
||||||
|
|
||||||
|
# Imports
|
||||||
|
import math
|
||||||
|
|
||||||
|
# Get values from user
|
||||||
|
side1 = float(input("Enter 1st side: "))
|
||||||
|
side2 = float(input("Enter 2nd side: "))
|
||||||
|
|
||||||
|
# Calculate values
|
||||||
|
side3 = math.sqrt((side1**2)+(side2**2))
|
||||||
|
|
||||||
|
# Print Values
|
||||||
|
print(f"The Hypotenuse's length is {side3} units.")
|
||||||
11
basic programming/1st task/5.py
Normal file
11
basic programming/1st task/5.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Q5
|
||||||
|
|
||||||
|
# Get values from user
|
||||||
|
first_name = input("Enter first name: ")
|
||||||
|
last_name = input("Enter surname: ")
|
||||||
|
id_number = int(input("Enter ID Number: "))
|
||||||
|
mat_average = float(input("Enter matriculation exams average: "))
|
||||||
|
|
||||||
|
# Print values and types
|
||||||
|
for variable in [first_name, last_name, id_number, mat_average]:
|
||||||
|
print(f"{variable} - {type(variable)}")
|
||||||
Reference in New Issue
Block a user