Movatterモバイル変換


[0]ホーム

URL:


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

Commit0e38c36

Browse files
authored
Add files via upload
1 parentc2933ae commit0e38c36

35 files changed

+432
-0
lines changed

‎Scripts/List.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/python
2+
spam= ['ankit','arjun','arun']
3+
print(spam)
4+
spam.append('anurag')
5+
print(spam)
6+
spam.insert(1,'elliot')
7+
print(spam)
8+
spam.remove('arun')
9+
print(spam)

‎Scripts/List_4.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/python3
2+
spam= [2,5,3.14,1.1,7]
3+
spam.sort()
4+
print(spam)

‎Scripts/Prime.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/python
2+
#Program to find prime and non prime number
3+
no=int(input("Enter the number:\n"))
4+
b=0
5+
foriin {1,50}:
6+
7+
ifno%i==0:
8+
b=b+1
9+
10+
ifb==2:
11+
print(no,"is prime number:\n")
12+
else:
13+
print(no,"is non prime number:\n")

‎Scripts/String_Manipulate.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/python3
2+
print('How are you?')
3+
feeling=input()
4+
iffeeling.lower()=='great':
5+
print('I feel great too!')
6+
else:
7+
print('I hope the rest of day is good!')

‎Scripts/fib_naci.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/python
2+
3+
deffib(n):# write Fibonacci series up to n
4+
a,b=0,1
5+
whilea<n:
6+
print(a,end=' ')
7+
a,b=b,a+b
8+
print(a,b)
9+
10+
fib(5)

‎Scripts/forWithList.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/python3
2+
list1= ['banana','mango','book','table']
3+
foriinrange(len(list1)):
4+
print('He gave me '+str(i)+' '+' '+list1[i]+' '+'in my birthday')

‎Scripts/for_loop.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/python
2+
#for is a looping statement in python
3+
item=['john','cena','johnson','vicky','rock']
4+
foriinitem:
5+
print(item)

‎Scripts/for_loop2.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/python
2+
3+
foriinrange(0,10):
4+
i=i+1
5+
print(i)

‎Scripts/for_loop3.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/python
2+
#Finding factorial of number using for loop
3+
4+
n=int(input("\nenter the number:\n"))
5+
f=1
6+
foriinrange(1,n):
7+
i=i+1
8+
f=f*i
9+
10+
print("\nfactorial of number ",n,"is : ",f)

‎Scripts/function_1.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/python
2+
#function are reusable code in every language
3+
#In python we use 'def' keyword to declare function
4+
5+
defPrint():#declaretion of function
6+
print("Function in Python Programming!\n")#Body of function
7+
8+
Print()#Function calling

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp