Skip to content

Commit 7708edd

Browse files
Add files via upload
1 parent b63f670 commit 7708edd

File tree

100 files changed

+1702
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+1702
-0
lines changed

1Escape_Sequence.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# \' --> Single quote
2+
print('I\'m uttam')
3+
# \" --> Double quote
4+
print("hello \"uttam sir\" world")
5+
# \\ --> Backslash
6+
print("this is uttam singh\\")
7+
# \n --> new line
8+
print("uttam \nsingh\nHow are you")
9+
# \t --> tab
10+
print("name \tuttam")
11+
# \b --> backspace
12+
print("uttamm\b")

Chapter 1/1Escape_Sequence.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# \' --> Single quote
2+
print('I\'m uttam')
3+
# \" --> Double quote
4+
print("hello \"uttam sir\" world")
5+
# \\ --> Backslash
6+
print("this is uttam singh\\")
7+
# \n --> new line
8+
print("uttam \nsingh\nHow are you")
9+
# \t --> tab
10+
print("name \tuttam")
11+
# \b --> backspace
12+
print("uttamm\b")

Chapter 1/2comments.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# this is a name comment
2+
print("name uttam singh")
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
print("uttam \\n singh")
2+
print("\\\" \\\' ")
3+
#\' - '
4+
#\\ - \
5+
#\\\' - \'

Chapter 1/5Raw_Strings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
print(r"this is a \n uttam sir")
2+
print(r"this is a very high level programming language \n sir can we will do something for these boys")

Chapter 1/6calculater.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
print(6+5+8/3)
2+
print(5/6) # floating point division
3+
print(4//2) # integer division
4+
print(2**3) # square root value
5+
print(2**0.8)
6+
print(round(2**0.8, 5))

Chapter 1/7variables.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print

Chapter 1/7variables1.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
number1 = 2
2+
print(number1)
3+
4+
number2 = 5
5+
print(number2)
6+
7+
8+
name = "uttam sir"
9+
print(name)
10+
name = 555
11+
print(name)
12+
13+
name_of_chair_man = "uttamSingh"

Chapter 1/8Summary_chapter_1.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# ************************************************** Summary of chapter 1 *******************************************
2+
# print function
3+
print("uttam \"uttam\' ")
4+
5+
# escape sequence
6+
print("uttam \tsingh")
7+
print("singh")
8+
print("this is a double backslash \\\\")
9+
10+
# escape sequence as normal text
11+
print(r"uttam \n singh")
12+
13+
# python as calculator
14+
print(2+5)
15+
print(16-87)
16+
print(5*6)
17+
print(5/4)
18+
print(15//4)
19+
print(2**4**6)
20+
print((2+4)*5/3)
21+
22+
# variables
23+
name = "Uttam singh"
24+
print(name)
25+
name =555
26+
print(name)
27+
28+
# naming rules for variables
29+
name1 = "Uttam singh" # no error
30+
print(name1)
31+
# 1name = "Uttam singh" -------> error
32+
# name$ = "uttam singh" -------> error
33+
# $name = "uttam singh" -------> error
34+
_name = "Uttam singh"
35+
print(_name)
36+
37+
# convention for variable naming
38+
user_name = "UTTAM" # snamke case writing
39+
useOne = "UTTAM" #camel case writing

Chapter 1/Exercise_1.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# *************************** print these following lines ************************
2+
# this is \\ double backslash
3+
# these are /\/\/\/\/\ mountain
4+
# he is awesome (use escape sequence intead of manual spaces--->{\t})
5+
# \" \n \t \'
6+
print("this is a \\\\double backslash")
7+
print("these are /\\ /\\ /\\ /\\ /\\ mountains")
8+
print("he is\tawesome")
9+
print("\\\" \\n \\t \\'")

Chapter 1/helloWorld.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
print("hello 'hello sir' world")
2+
print('hello "hello sir" world')
3+
# String--> Collection of character insinde "Double quotes" or 'Single quotes'

Chapter 2/10step_argument.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# step argument
2+
print("uttam singh"[0:12:1])
3+
print("uttam singh"[::-1])
4+
print("uttam singh"[12::-1])
5+
print("uttam singh"[4:9:2])

Chapter 2/11Exercise_2.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Question ---> Ask user name and print back user name in reverse order ?
2+
# note:- Try to make your program in two lines using string formatting.
3+
4+
user_name = "UTTAM SINGH"
5+
print(user_name [::-1])
6+
7+
name = "UTTAM SINGH"
8+
reverse = name[::-1]
9+
print(f"this is your reverse name : {reverse}")

Chapter 2/12string_method_part_1.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# String methods part one
2+
# Difference between methods and function
3+
# Dono hamare liye functionality diffine krte hai
4+
name = "uTTaM SinGh"
5+
6+
7+
# 1. len() function
8+
print(len("Uttam"))
9+
10+
lenght = "Singh Uttam Dhirendra"
11+
print(len(lenght))
12+
13+
# 2. lower () method
14+
print(name.lower())
15+
16+
# 3. upper () method
17+
print(name.upper())
18+
19+
# 4. title () method
20+
print(name.title())
21+
22+
# 5. count () method
23+
print(name.count("M"))

Chapter 2/13Exercise_3.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Take two comma separated inputs from user
2+
# 1). User's name
3+
# 2). A single character , "U"
4+
5+
# Output - 2 print lines
6+
# 1). User's name length
7+
# 2). Count the character that user inputed (bonus : case insensitive count)
8+
name, char = input("Enter your name and character : ").split(",")
9+
print(f"Lenght of your name is that : {len(name)}")
10+
# print(f"Character count is that : {name.lower().count(char.lower())}")
11+
print(f"Character count is that : {name.strip().lower().count(char.strip().lower())}")

Chapter 2/14strip_method.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name = " utt am "
2+
dots = "...................."
3+
# lstrip method
4+
print(name + dots)
5+
print(name.lstrip() + dots)
6+
print(name.rstrip() + dots)
7+
print(name.strip() + dots)
8+
print(name.replace(" ","")+dots)

Chapter 2/15string_method_part_2.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# replace () method
2+
# find () method
3+
4+
article = "What word is that to which if you add a syllable, it will make it shorter"
5+
print(article.replace(" ","_"))
6+
print(article.find("make"))
7+
8+
a_pos1 = article.find("it")
9+
a_pos2 = article.find("it", a_pos1+1)
10+
print(a_pos2)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Center method
2+
# name = "Uttam Singh"
3+
# print(name.center(20,"~"))
4+
5+
name = input("Enter the your name : ")
6+
print(name.center(len(name)+4, "~"))

Chapter 2/17strings_are_immutable.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Immutable means in python ----> python mein original string ko change nhi kr skte hai
2+
3+
string = "uttam bhai"
4+
string.replace("b","B")
5+
print(string)

Chapter 2/18more_operators.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name = "Uttam "
2+
# name = name + "singh"
3+
name += "singh"
4+
print(name)
5+
6+
age = 21
7+
age -= 2
8+
age += 1
9+
print(age)

Chapter 2/19summary_of_chapter_2.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# string
2+
name = "Uttam singh"
3+
4+
# string indexing
5+
print(name[4])
6+
7+
# string slicing
8+
print(name[0:7])
9+
print(name[::-1])
10+
print(name[-1:12:2])
11+
12+
# Take user input
13+
name, age = input("enter the your name and age : ").split(",")
14+
print(name)
15+
print(age)
16+
17+
# length function
18+
print(len(name))
19+
20+
# lower , upper , title method
21+
print(name.lower())
22+
print(name.upper())
23+
print(name.title())
24+
25+
# find ,replace, center method
26+
print(name.find("t"))
27+
print(name.center(15,"*^"))
28+
print(name.replace("s","S"))
29+
30+
# string are immutable
31+
string.replace("s","S")
32+
print(string)

Chapter 2/1String_Concatenation.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Stirng --> Collection of characters inide single quotes or double quotes
2+
3+
first_name = "uttam"
4+
last_name = "Singh"
5+
full_name = first_name +" "+ last_name
6+
print(full_name)
7+
# # print(full_name + 5) -----> Error
8+
# print(full_name + "5") -----> No error
9+
# print(full_name + str(5)) -----> No error
10+
# print(full_name * 5) -----> No error

Chapter 2/2User_input.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# user input
2+
# input ----> Input function hamesha string mein value leta hai numbers mein value nhi leta hai
3+
4+
name = input("Enter your name")
5+
print("hello" + name)
6+
# String
7+
age = input("What is your age")
8+
print("your age is " + age)
9+
10+
place = input("What is your state name")
11+
print("this is your state name" + place)

Chapter 2/3int()_Function.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# number_1 = int(input("enter the your lucky number sir"))
2+
# number_2 = int(input("enter your second lucky cupon number sir"))
3+
# total = number_1 + number_2
4+
# print("you are not able to go in party sir /t" + str(total))
5+
6+
number_1 = str(5)
7+
number_2 = int("5")
8+
number_3 = float("555")
9+
print(number_2 + number_3)
10+
# final output float mein aayega

Chapter 2/4maore_about_variables.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
name, age, place = "Uttam Singh", "20", "maharashtra mumbai"
2+
print("hello\t" + name + "\tyour age is\t" + age + "\tyou are from\t" + place)
3+
x=y=z=5
4+
print(x+y+z)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# # split ----> Split is a string method we will see many more string methods in this chapter
2+
# name = input("Enter the your name sir please")
3+
# age = input("What is your age sir ")
4+
# print(name + age)
5+
6+
name, age = input("Enter the your name sir and your age also enter ").split(",")
7+
print(name)
8+
print(age)
9+

Chapter 2/6String_Formating.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name = "Uttam singh"
2+
age = "20"
3+
4+
print("hello sir " + name + " your age is" + age)
5+
6+
# this method is used in python 3
7+
print("hello {} your age is {}".format(name, age))
8+
9+
10+
# this method is used in python 3.6
11+
print(f"hello {name} your age is{age}")

Chapter 2/7Exercise_1.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Question --> Ask user to input 3 numbers and you have to print average of three numbers using string formatting ?
2+
# Bonus:- Try to take all three comma separated inputs in one line.
3+
4+
# first soluation
5+
number1 = int(input("Enter the three number : "))
6+
number2 = int(input("Enter the three number : "))
7+
number3 = int(input("Enter the three number : "))
8+
total = number1 + number2 + number3
9+
print(total / 3)
10+
11+
# second soluation
12+
number1 = int(input("\nEnter the three number : "))
13+
number2 = int(input("Enter the three number : "))
14+
number3 = int(input("Enter the three number : "))
15+
print(f"average of three numbers : {(int(number1) + int(number2) + int(number3)) / 3}\n")
16+
17+
# Bonus soluation
18+
num1, num2, num3 = input("\nEnter the three numbers comma seprated : ").split(",")
19+
print(f"average of three numbers : {(int(number1) + int(number2) + int(number3)) / 3}")

Chapter 2/8string_indexing.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# String indexing
2+
language = "python"
3+
4+
# Positions(index number)
5+
# p = 0 , -6
6+
# y = 1 , -5
7+
# t = 2 , -4
8+
# h = 3 , -3
9+
# o = 4 , -2
10+
# n = 5 , -1
11+
12+
13+
print(language[-1])

Chapter 2/9string_slicing.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# slicing / selecting sub sequences
2+
name = "uttam singh"
3+
print(name[4])
4+
# syntax - [start argument : stop argument -1]
5+
print(name[0:9])
6+
print(name[:8])
7+
print(name[2:])

Chapter 3/10_Loops.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# While Loops
2+
# Do While Loops
3+
# For Loops
4+
s=1
5+
while s<=10:
6+
print(f"Uttam singh {s}")
7+
# s = s + 1
8+
s += 1

Chapter 3/11_while_sum.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
total = 0
2+
U = 1
3+
while U<=10:
4+
total = total + U
5+
U = U + 1
6+
print(total)

0 commit comments

Comments
 (0)