Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main #40

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Main #40

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Day-02/examples/01-string-len.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
text = "Python is awesome"
length = len(text)
print("Length of the string:", length)

test = "aarna is good company"
length1 = len(test)
print("length of the string:", length1)
41 changes: 40 additions & 1 deletion Day-02/examples/01-string-lowercase.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
text = "Python is awesome"
text = "Python is Awesome"
uppercase = text.upper()
lowercase = text.lower()
print("Uppercase:", uppercase)
print("Lowercase:", lowercase)












test = "king is always KING"
upper1 = test.upper()
lower1 = test.lower()
print("UPPERCASE:", upper1)
print("lower:", lower1)

















aarna = "aarna is good COMPANY"
upper2 = aarna.upper()
lower2 = aarna.lower()
print("Uppercase:", upper2)
print("Lowercase:", lower2)
15 changes: 15 additions & 0 deletions Day-02/examples/01-string-replace.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
text = "Python is awesome"
new_text = text.replace("awesome", "great")
print("Modified text:", new_text)












test = "pramod is awesome Muktawar"
new_cn = test.replace("pramod", "prasad")
print("modified:", new_cn)
49 changes: 49 additions & 0 deletions Day-02/examples/01-string-split.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,52 @@
text = "Python is awesome"
words = text.split()
print("Words:", words)

















test = "pramod is muktawar"
new = test.split()
print("Words:", new)











test1 = "king is slave"
# Split the string into words
words = test1.split()

# Convert each word to uppercase and store it in a list
upper_words = [word.upper() for word in words]

# Join the uppercase words back into a string
result = " ".join(upper_words)

print("Uppercase words:", result)







11 changes: 11 additions & 0 deletions Day-02/examples/01-string-substring.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,14 @@
substring = "is"
if substring in text:
print(substring, "found in the text")



test = "pramod was king"
substring1 = "pramod"
if substring1 in test:
print(substring1, "found in test" )


result = substring1 + " " + substring
print("addition:", result)
4 changes: 2 additions & 2 deletions Day-02/examples/02-float.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Float variables
num1 = 5.0
num1 = 5.1499
num2 = 2.5

# Basic Arithmetic
Expand All @@ -16,5 +16,5 @@
print("Division:", result4)

# Rounding
result5 = round(3.14159265359, 2) # Rounds to 2 decimal places
result5 = round(result4, 2) # Rounds to 2 decimal places
print("Rounded:", result5)
9 changes: 9 additions & 0 deletions Day-02/examples/02-int.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,12 @@
# Absolute Value
result3 = abs(-7)
print("Absolute Value:", result3)

result4 = num1 * num2
print("multiplication:", result4)

result5 = num1 - num2
print("substraction:", result5)

result6 = abs(-55)
print("abbstraction:", result6)
9 changes: 9 additions & 0 deletions Day-02/examples/03-regex-findall.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,12 @@
print("Pattern found:", search.group())
else:
print("Pattern not found")

test = "hi i am pramod muktawar"
pattern1 = r"pramod"

search1 = re.search(pattern1, test)
if search1:
print("pattern found:", search1.group())
else:
print("pattern not found")
3 changes: 2 additions & 1 deletion Day-02/examples/03-regex-match.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import re

text = "The quick brown fox"
text = " brown quick fox"
pattern = r"quick"

match = re.match(pattern, text)
if match:
print("Match found:", match.group())
else:
print("No match")

8 changes: 8 additions & 0 deletions Day-02/examples/03-regex-replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@

new_text = re.sub(pattern, replacement, text)
print("Modified text:", new_text)



test = "the cow is black and calf is also black."
pattern1 = r"black"
replacement1 = "white"
test1 = re.sub(pattern1, replacement1, test)
print("modified text:", test1)
10 changes: 9 additions & 1 deletion Day-02/examples/03-regex-search.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import re

text = "The quick brown fox"
text = " brown The quick brown fox"
pattern = r"brown"
replacement = "red"
pattern1 = " , "

search = re.search(pattern, text)
if search:
print("Pattern found:", search.group())
else:
print("Pattern not found")

new = re.sub(pattern, replacement, text)
print("modified text:", new)

new1 = re.split(pattern1, new)
print("split result:", new1)
14 changes: 14 additions & 0 deletions Day-02/examples/replace.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import re

text = "aarna is bad company with good peoples"
pattern = r"good"
replacement = "bad"

patterrn1 = r"bad"
replacement1 = "good"

new = re.sub(pattern, replacement, text)

new1 = re.sub(patterrn1, replacement1, new)

print("Modified text:", new1)
14 changes: 14 additions & 0 deletions Day-02/terraform/test.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
variable "name" {
type = string

}

variable "age" {
type = number

}

output "info" {
value = "my name is ${var.name} and my age is ${var.age}"

}
19 changes: 19 additions & 0 deletions Day-02/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
arn = "arn:aws:iam::123456789012:user/Development/product_1234/"
name = "pramod"
sur = "MUKTAWAR"

print(arn.split("/")[3])
print(arn.split(":"))


print(name.upper())
print(sur.lower())

num1 = 2.05555
num2 = 3.55558

result = num1 + num2
print("addition:", result)

result1 = round(result, 2)
print("round of:", result1)
20 changes: 20 additions & 0 deletions Day-03/float.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Float variables
num1 = 5.1499
num2 = 2.5

# Basic Arithmetic
result1 = num1 + num2
print("Addition:", result1)

result2 = num1 - num2
print("Subtraction:", result2)

result3 = num1 * num2
print("Multiplication:", result3)

result4 = num1 / num2
print("Division:", result4)

# Rounding
result5 = round(result4, 2) # Rounds to 2 decimal places
print("Rounded:", result5)
21 changes: 21 additions & 0 deletions Day-03/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
a = 50
b = 5

def add():
a = 10
b = 20
print(a + b)



def sub():
c = 5
b = 30
print(a - b - c )

def kill():
print(a * b)

kill()
add()
sub()
22 changes: 22 additions & 0 deletions Day-04/advance_cal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import calculator_new as basic_cal # as works as alis and we are giving alis name to calculator_new as basic_cal

#calculator_new is already devloped program so we are calling it i here as module to call module in here keyword is import
#module is nothing but group of functions

num = 4
num = 2

basic_cal.adition()

#now we are importing module from different location here it how to do

import sys
sys.path.append('/workspaces/python-for-devops/Day-03/') #this is path to module to call in this script
import float as floatc #creating alias name
#while giving path to module just give file name dont provide extension

floatc

from calculator_new import abbstraction #this is used fro calling only specific funtion from module

abbstraction()
11 changes: 11 additions & 0 deletions Day-04/calculator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#num = 6
#num1 = 3

add = num + num1
print("addition value", add)

sub = num - num1
print("substraction value - " + str(sub))

mul = num1 * num
print("multiplication value:-", mul)
24 changes: 24 additions & 0 deletions Day-04/calculator_new.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
num = 6
num1 = 3
num2 = -8

def adition():
add = num + num1
print(add)

def substraction():
sub = num - num1
print(sub)

def multiplication():
mull = num1 * num
print(mull)

def abbstraction():
aj = abs(num2)
print(aj)

adition()
substraction()
multiplication()
abbstraction()
Loading