diff --git a/Rashid_Ashfaq/Flaskfundamentals/Counter/server.py b/Rashid_Ashfaq/Flaskfundamentals/Counter/server.py new file mode 100644 index 0000000..240bedb --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/Counter/server.py @@ -0,0 +1,23 @@ +from flask import Flask ,render_template, request ,redirect,session +app = Flask(__name__) +app.secret_key="ThisisSecret" + +@app.route('/') +def index(): + if session.get('counter') == None: + session['counter'] =2 + + return render_template('index.html') + +@app.route('/addcount',methods=['POST']) +def addcounter(): + session['counter'] +=2 + return redirect('/') + +@app.route('/resetcount',methods=['POST']) +def reset(): + session['counter'] = 1 + return redirect('/') + +app.run(debug=True) + diff --git a/Rashid_Ashfaq/Flaskfundamentals/Counter/templates/index.html b/Rashid_Ashfaq/Flaskfundamentals/Counter/templates/index.html new file mode 100644 index 0000000..057bf4f --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/Counter/templates/index.html @@ -0,0 +1,26 @@ + + + + Counter + + + +

Counter

+ {{session['counter']}} +
+
+ +
+
+ +
+
+ + \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/server.py b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/server.py new file mode 100644 index 0000000..5062e73 --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/server.py @@ -0,0 +1,29 @@ +from flask import Flask ,render_template +app =Flask(__name__) +@app.route('/') +def index(): + return render_template("index.html",display ="NO NINJA HERE") +@app.route('/ninja') +def ninja(): + return render_template('ninja.html') + +@app.route('/ninja/blue') +def ninjablue(): + return render_template('blue.html') + +@app.route('/ninja/orange') +def ninjaorange(): + return render_template('orange.html') + +@app.route('/ninja/red') +def ninjared(): + return render_template('red.html') + +@app.route('/ninja/purple') +def ninjpurple(): + return render_template('purple.html') +@app.route('/ninja/') +def notapril(username): + return render_template("notapril.html", username=username) + +app.run(debug=True) \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/static/css/style.css b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/static/css/style.css new file mode 100644 index 0000000..52d269b --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/static/css/style.css @@ -0,0 +1,4 @@ +h1{ + color: blue; + text-align: center; +} \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/static/img/donatello.jpg b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/static/img/donatello.jpg new file mode 100644 index 0000000..8912292 Binary files /dev/null and b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/static/img/donatello.jpg differ diff --git a/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/static/img/leonardo.jpg b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/static/img/leonardo.jpg new file mode 100644 index 0000000..c049cfd Binary files /dev/null and b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/static/img/leonardo.jpg differ diff --git a/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/static/img/michelangelo.jpg b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/static/img/michelangelo.jpg new file mode 100644 index 0000000..4ad75d0 Binary files /dev/null and b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/static/img/michelangelo.jpg differ diff --git a/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/static/img/notapril.jpg b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/static/img/notapril.jpg new file mode 100644 index 0000000..39b2f0a Binary files /dev/null and b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/static/img/notapril.jpg differ diff --git a/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/static/img/raphael.jpg b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/static/img/raphael.jpg new file mode 100644 index 0000000..57fb2a3 Binary files /dev/null and b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/static/img/raphael.jpg differ diff --git a/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/static/img/tmnt.png b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/static/img/tmnt.png new file mode 100644 index 0000000..941c82e Binary files /dev/null and b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/static/img/tmnt.png differ diff --git a/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/templates/blue.html b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/templates/blue.html new file mode 100644 index 0000000..c8078c5 --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/templates/blue.html @@ -0,0 +1,10 @@ + + + + Blue Ninja + + + + + + \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/templates/index.html b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/templates/index.html new file mode 100644 index 0000000..707315a --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/templates/index.html @@ -0,0 +1,17 @@ + + + + Disappearing Ninja + + + + +

{{display}}

+ + \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/templates/ninja.html b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/templates/ninja.html new file mode 100644 index 0000000..8c5fb4f --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/templates/ninja.html @@ -0,0 +1,9 @@ + + + + display all four Ninja + + + + + \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/templates/notapril.html b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/templates/notapril.html new file mode 100644 index 0000000..d88611d --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/templates/notapril.html @@ -0,0 +1,10 @@ + + + + NOtAPRIL + + + + + + \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/templates/orange.html b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/templates/orange.html new file mode 100644 index 0000000..4d9a47b --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/templates/orange.html @@ -0,0 +1,10 @@ + + + + Orange Ninja + + + + + + \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/templates/purple.html b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/templates/purple.html new file mode 100644 index 0000000..5c553ab --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/templates/purple.html @@ -0,0 +1,10 @@ + + + + Purple Ninja + + + + + + \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/templates/red.html b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/templates/red.html new file mode 100644 index 0000000..7542af8 --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/DisappearingNinja/templates/red.html @@ -0,0 +1,10 @@ + + + + Red Ninja + + + + + + \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/DojoSurvey/server.py b/Rashid_Ashfaq/Flaskfundamentals/DojoSurvey/server.py new file mode 100644 index 0000000..009924c --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/DojoSurvey/server.py @@ -0,0 +1,31 @@ +from flask import Flask, render_template ,request ,redirect,session, flash +app = Flask(__name__) +app.secret_key ="KeepItSecretKeepItSafe" +@app.route('/') +def index(): + return render_template('index.html') + +@app.route('/result', methods=['POST']) +def result(): + name =request.form['name'] + if len(request.form['name'])<1: + flash("Name cannot be empty") + return redirect('/') + location =request.form['location'] + language=request.form["language"] + comment=request.form['comment'] + if len(request.form['comment'])<1: + flash("Comment can not be empty") + return redirect('/') + if len(comment)>120: + flash("Comment no more then 120 character ") + return redirect('/') + + return render_template('result.html',name= name,location=location,language=language,comment=comment) + return render_template('index.html') +@app.route('/back') +def back(): + return render_template('index.html') + +app.run(debug=True) + diff --git a/Rashid_Ashfaq/Flaskfundamentals/DojoSurvey/static/css/style.css b/Rashid_Ashfaq/Flaskfundamentals/DojoSurvey/static/css/style.css new file mode 100644 index 0000000..188e1de --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/DojoSurvey/static/css/style.css @@ -0,0 +1,7 @@ +.dojoform ul{ + width: 750px; + list-style-type: none; + list-style-position: outside; + margin: 0px; + padding: 0px; +} \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/DojoSurvey/templates/index.html b/Rashid_Ashfaq/Flaskfundamentals/DojoSurvey/templates/index.html new file mode 100644 index 0000000..5dfe112 --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/DojoSurvey/templates/index.html @@ -0,0 +1,81 @@ + + + + Dojo Survey Index + + + + + + {% with messages = get_flashed_messages() %} + {%if messages%} + {% for message in messages%} +

{{message}}

+ {% endfor%} + {%endif%} + {%endwith%} +
+ + +
+ + \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/DojoSurvey/templates/result.html b/Rashid_Ashfaq/Flaskfundamentals/DojoSurvey/templates/result.html new file mode 100644 index 0000000..839129e --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/DojoSurvey/templates/result.html @@ -0,0 +1,70 @@ + + + + Dojo Survey Index + + + + {% with messages = get_flashed_messages() %} + {%if messages%} + {% for message in messages%} +

{{message}}

+ {% endfor%} + {%endif%} + {%endwith%} + +
+ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/Greatnumgame/server.py b/Rashid_Ashfaq/Flaskfundamentals/Greatnumgame/server.py new file mode 100644 index 0000000..fa3bacc --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/Greatnumgame/server.py @@ -0,0 +1,47 @@ +from flask import Flask, render_template, redirect, request, session + +import random + +app = Flask(__name__) + +app.secret_key = 'numbergame' + +@app.route('/') + +def randomnumber(): + + if 'randnum' not in session: + + session['randnum'] = random.randint(1,100) + + return render_template('index.html') + +@app.route('/guessnumber', methods=['POST']) + +def guessnumber(): + + print "Randum Number=", session['randnum'] + + print "My Number=", request.form['number'] + + if int(request.form['number']) == session['randnum']: + + return render_template('index.html', result=request.form['number']+" was the number!", color="green",flag="True") + + elif int(request.form['number']) > session['randnum']: + + return render_template('index.html', result=request.form['number']+" was Too High!", color="red") + + else: + + return render_template('index.html', result=request.form['number']+" was Too Low!", color="red") + +@app.route('/reset') + +def reset(): + + session.pop('randnum') + + return redirect('/') + +app.run(debug=True) \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/Greatnumgame/static/css/style.css b/Rashid_Ashfaq/Flaskfundamentals/Greatnumgame/static/css/style.css new file mode 100644 index 0000000..925da9a --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/Greatnumgame/static/css/style.css @@ -0,0 +1,17 @@ +.container{ + width: 700px; + margin-top: 50px; + display: inline-block; + text-align: center; + margin-left: 150px; +} +h2{ + color: blue; + text-align: center; +} +#box{ + width: 200px; + height: 200px; + padding-top: 20px; + text-align: center; +} \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/Greatnumgame/templates/index.html b/Rashid_Ashfaq/Flaskfundamentals/Greatnumgame/templates/index.html new file mode 100644 index 0000000..c16ead7 --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/Greatnumgame/templates/index.html @@ -0,0 +1,51 @@ + + + + Great Number Game + + + + +
+

Welcome to the Great Number Game!

+

I am thinking of a number between 1 and 100

+

Take a guess!

+
+ {% if result %} +
+

{{result}}

+ {% if flag == "True" %} + + + + {% endif %} +
+ {% endif %} + {% if flag != "True" %} + + + + + {% endif %} + + \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/Registration_Form/server.py b/Rashid_Ashfaq/Flaskfundamentals/Registration_Form/server.py new file mode 100644 index 0000000..26170af --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/Registration_Form/server.py @@ -0,0 +1,45 @@ +from flask import Flask, render_template,redirect,request,session,flash +import re +EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$') +PASSWORD_REGEX = re.compile(r'.*[0-9].*') +Upper_REGEX = re.compile(r'.*[A-Z].*') +app =Flask(__name__) +app.secret_key ="ThisIsSecret!" +@app.route('/', methods=['GET']) +def index(): + return render_template('index.html') + +@app.route('/process', methods=['POST']) +def submit(): + if len(request.form['email'])<1: + flash("Email cannot be blank") + elif not EMAIL_REGEX.match(request.form['email']): + flash("Invalid Email Address!") + elif len(request.form['first_name'])<1: + flash("First Name cannot be empty") + elif re.search(r'[0-9]',request.form['first_name']): + flash("First Name cannot contain any number") + elif len(request.form['last_name'])<1: + flash("Last Name cannot be empty") + elif re.search(r'[0-9]' ,request.form['last_name']): + flash("Last Name cannot contain any number") + elif len(request.form['password'])<1: + flash("Password cannot be empty") + elif len(request.form['password'])<8 and len(request.form['confrim'])<8: + flash("Password should be more then 8 character") + elif not PASSWORD_REGEX.match(request.form['password']): + flash("Password Contain atleast 1 number ") + elif not Upper_REGEX.match(request.form['password']): + flash("Password Contain atleast 1 Uppercase letter") + elif len(request.form['confrim'])<1: + flash("Password cannot be empty") + elif request.form['password']!= request.form['confrim']: + flash("Password not match try again!") + elif len(request.form['date'])<1: + flash("Birth Date cannot be empty") + + else: + flash("Thank You Register Sucessfully !") + + return redirect('/') +app.run(debug=True) \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/Registration_Form/static/css/style.css b/Rashid_Ashfaq/Flaskfundamentals/Registration_Form/static/css/style.css new file mode 100644 index 0000000..e69de29 diff --git a/Rashid_Ashfaq/Flaskfundamentals/Registration_Form/templates/index.html b/Rashid_Ashfaq/Flaskfundamentals/Registration_Form/templates/index.html new file mode 100644 index 0000000..18ea078 --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/Registration_Form/templates/index.html @@ -0,0 +1,89 @@ + + + + Registration Form + + + + + + + {% with messages = get_flashed_messages(with_categories=true) %} + {% if messages %} + + {% endif %} + {% endwith %} + + + + + + \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/View/helloworld.py b/Rashid_Ashfaq/Flaskfundamentals/View/helloworld.py new file mode 100644 index 0000000..5e674c9 --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/View/helloworld.py @@ -0,0 +1,6 @@ +from flask import Flask,render_template +app = Flask(__name__) +@app.route('/') +def hello(): + return render_template("index.html", name="Jay") +app.run(debug=True) diff --git a/Rashid_Ashfaq/Flaskfundamentals/View/templates/index.html b/Rashid_Ashfaq/Flaskfundamentals/View/templates/index.html new file mode 100644 index 0000000..a21e0f2 --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/View/templates/index.html @@ -0,0 +1,9 @@ + + + + Template Test + + +

my name is {{name}}

+ + \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/advance_routing/server.py b/Rashid_Ashfaq/Flaskfundamentals/advance_routing/server.py new file mode 100644 index 0000000..4909a5c --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/advance_routing/server.py @@ -0,0 +1,13 @@ +from flask import Flask, render_template,request,redirect +app = Flask(__name__) +#@app.route('/users/') +@app.route('/users//') +def show_user_profile(username, id): + print username + print id + return render_template("user.html") +#def show_user_profile(username): +# print username +# return render_template("user.html") +# @app.roue('/route/with/') +app.run(debug=True) \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/basic_validation/server.py b/Rashid_Ashfaq/Flaskfundamentals/basic_validation/server.py new file mode 100644 index 0000000..6c66a82 --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/basic_validation/server.py @@ -0,0 +1,24 @@ +from flask import Flask, render_template,redirect,request,session, flash +import re #for email validaion + +EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9._-]+\.[a-zA-z]+$') +app =Flask(__name__) +app.secret_key ='ThisIsSecret' +@app.route('/', methods=['GET']) +def index(): + return render_template('index.html') +@app.route('/process', methods =['POST']) +def submit(): + if len(request.form['email'])<1: + flash("Email cannot be blank") + elif not EMAIL_REGEX.match(request.form['email']): + flash("Invalid Email Address!") + + else: + + flash("Success!") + return redirect('/') + +app.run(debug=True) + + diff --git a/Rashid_Ashfaq/Flaskfundamentals/basic_validation/templates/index.html b/Rashid_Ashfaq/Flaskfundamentals/basic_validation/templates/index.html new file mode 100644 index 0000000..13b8f19 --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/basic_validation/templates/index.html @@ -0,0 +1,21 @@ + + + + Basic Validation Example + + +

Enter a Valid(Any)Email!

+ {% with messages = get_flashed_messages() %} + {% if messages%} + {% for message in messages%} +

{{message}}

+ {% endfor%} + {% endif %} + {% endwith%} +
+ Email: + + + + + \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/form_test/server.py b/Rashid_Ashfaq/Flaskfundamentals/form_test/server.py new file mode 100644 index 0000000..6e57dc5 --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/form_test/server.py @@ -0,0 +1,21 @@ +from flask import Flask, render_template, request, redirect,session +app = Flask(__name__) +app.secret_key='ThisisSecret' + +@app.route('/') +def index(): + return render_template('index.html') + +@app.route('/users',methods=['POST']) +def create_user(): + print "Got Post Info" + + session['name'] = request.form['name'] + session['email'] = request.form['email'] + #return render_template('user.html', name=name,email=email) + return redirect('/show') +@app.route('/show') +def show(): + return render_template('user.html') + +app.run(debug=True) \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/form_test/templates/index.html b/Rashid_Ashfaq/Flaskfundamentals/form_test/templates/index.html new file mode 100644 index 0000000..764a99e --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/form_test/templates/index.html @@ -0,0 +1,15 @@ + + + + Form Test Index + + +

Index Page

+

Create a User

+
+ Name: + Email: + + + + \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/form_test/templates/user.html b/Rashid_Ashfaq/Flaskfundamentals/form_test/templates/user.html new file mode 100644 index 0000000..a16a34d --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/form_test/templates/user.html @@ -0,0 +1,12 @@ + + + + From Test show + + +

User:

+

{{session['name']}}

+

{{session['email']}}

+ + + \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/hello_flask/hello.py b/Rashid_Ashfaq/Flaskfundamentals/hello_flask/hello.py new file mode 100644 index 0000000..617478b --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/hello_flask/hello.py @@ -0,0 +1,20 @@ +from flask import Flask, render_template +app = Flask(__name__) +@app.route('/') +def my_portfolio(): + return render_template('portfolio.html') + +@app.route('/project') +def my_projects(): + return render_template('project.html') + +@app.route('/about') +def about_me(): + return render_template('aboutMe.html') + +app.run(debug=True) + + + +#def hellow_world(): +# return render_template('helloworld.html') diff --git a/Rashid_Ashfaq/Flaskfundamentals/hello_flask/templates/aboutMe.html b/Rashid_Ashfaq/Flaskfundamentals/hello_flask/templates/aboutMe.html new file mode 100644 index 0000000..2e208db --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/hello_flask/templates/aboutMe.html @@ -0,0 +1,4 @@ +

i am a Python web developer and love going to + hackathons my spare time.I love making things and + meaning new people! People might be superised to learn + that I own a horse and used to be a hores tranier !

diff --git a/Rashid_Ashfaq/Flaskfundamentals/hello_flask/templates/helloworld.html b/Rashid_Ashfaq/Flaskfundamentals/hello_flask/templates/helloworld.html new file mode 100644 index 0000000..357aa28 --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/hello_flask/templates/helloworld.html @@ -0,0 +1,2 @@ +

Hello World !

+My name is Rashid \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/hello_flask/templates/index.html b/Rashid_Ashfaq/Flaskfundamentals/hello_flask/templates/index.html new file mode 100644 index 0000000..a58f8b6 --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/hello_flask/templates/index.html @@ -0,0 +1 @@ +hellow 2 \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/hello_flask/templates/portfolio.html b/Rashid_Ashfaq/Flaskfundamentals/hello_flask/templates/portfolio.html new file mode 100644 index 0000000..200abab --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/hello_flask/templates/portfolio.html @@ -0,0 +1 @@ +

Wellcome to my portfolio! My name is Rashid

\ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/hello_flask/templates/project.html b/Rashid_Ashfaq/Flaskfundamentals/hello_flask/templates/project.html new file mode 100644 index 0000000..45daaf7 --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/hello_flask/templates/project.html @@ -0,0 +1,8 @@ +
+

My Projec:

+
- Danger Zones
+
- Fat Unicorn:The poopening
+
- My Cohort
+
- Certify Me
+
- Woof Woof Go !
+
\ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/hello_flask/templates/success.html b/Rashid_Ashfaq/Flaskfundamentals/hello_flask/templates/success.html new file mode 100644 index 0000000..e6a1501 --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/hello_flask/templates/success.html @@ -0,0 +1 @@ +

yay you sucessfully create andother Get route that server a page !

\ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/leading_page/server.py b/Rashid_Ashfaq/Flaskfundamentals/leading_page/server.py new file mode 100644 index 0000000..24ccce7 --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/leading_page/server.py @@ -0,0 +1,15 @@ +from flask import Flask , render_template , request ,redirect +app = Flask(__name__) +@app.route('/') +def index(): + return render_template("index.html", phrase ="Wellcome To Leading Page") +@app.route('/ninjas') +def ninjas(): + return render_template("ninjas.html", phrase="Information About Ninjas") + +@app.route('/dojo/new') +def dojo(): + return render_template('dojos.html') + + +app.run(debug=True) \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/leading_page/static/css/style.css b/Rashid_Ashfaq/Flaskfundamentals/leading_page/static/css/style.css new file mode 100644 index 0000000..4516e10 --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/leading_page/static/css/style.css @@ -0,0 +1,4 @@ +h1{ + text-align: center; + color: blue; +} diff --git a/Rashid_Ashfaq/Flaskfundamentals/leading_page/static/img/ni.jpg b/Rashid_Ashfaq/Flaskfundamentals/leading_page/static/img/ni.jpg new file mode 100644 index 0000000..fbb8516 Binary files /dev/null and b/Rashid_Ashfaq/Flaskfundamentals/leading_page/static/img/ni.jpg differ diff --git a/Rashid_Ashfaq/Flaskfundamentals/leading_page/templates/dojos.html b/Rashid_Ashfaq/Flaskfundamentals/leading_page/templates/dojos.html new file mode 100644 index 0000000..c399e51 --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/leading_page/templates/dojos.html @@ -0,0 +1,22 @@ + + + + Dojo Page + + + +

Registration Form

+
+ Name : + Email: + Password: + + + + + + \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/leading_page/templates/index.html b/Rashid_Ashfaq/Flaskfundamentals/leading_page/templates/index.html new file mode 100644 index 0000000..0647f46 --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/leading_page/templates/index.html @@ -0,0 +1,10 @@ + + + + Landing Page + + + +

{{phrase}}

+ + \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/leading_page/templates/ninjas.html b/Rashid_Ashfaq/Flaskfundamentals/leading_page/templates/ninjas.html new file mode 100644 index 0000000..129c7a2 --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/leading_page/templates/ninjas.html @@ -0,0 +1,20 @@ + + + + Ninja page + + + +

{{phrase}}

+ +
    +
  • Display Information
  • +
  • Display Information
  • +
  • Display Information
  • +
  • Display Information
  • +
  • Display Information
  • +
  • Display Information
  • +
+ + + diff --git a/Rashid_Ashfaq/Flaskfundamentals/test_templates/server.py b/Rashid_Ashfaq/Flaskfundamentals/test_templates/server.py new file mode 100644 index 0000000..6e0d959 --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/test_templates/server.py @@ -0,0 +1,6 @@ +from flask import Flask,render_template +app = Flask(__name__) +@app.route('/') +def index(): + return render_template("index.html",phrase="hello",times=5) +app.run(debug=True) \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/test_templates/templates/index.html b/Rashid_Ashfaq/Flaskfundamentals/test_templates/templates/index.html new file mode 100644 index 0000000..7d03d1c --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/test_templates/templates/index.html @@ -0,0 +1,20 @@ + + + My First Template + + +

My flask template with embedded Python-like code

+ +

Phrase: {{ phrase }}

+ +

Times: {{ times }}

+ + {% for x in range(0,times): %} +

{{ phrase }}

+ {% endfor %} + + {% if phrase == "hello" %} +

The phrase says hello

+ {% endif %} + + \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/whatmyName/server.py b/Rashid_Ashfaq/Flaskfundamentals/whatmyName/server.py new file mode 100644 index 0000000..25fbceb --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/whatmyName/server.py @@ -0,0 +1,15 @@ +from flask import Flask, render_template, redirect, request +app = Flask(__name__) + +@app.route("/") +def index(): + return render_template("index.html") + +@app.route("/process", methods=["POST"]) +def process(): + print "Enter your Name" + name= request.form['name'] + print name + return redirect("/") + +app.run(debug=True) \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/whatmyName/static/css/style.css b/Rashid_Ashfaq/Flaskfundamentals/whatmyName/static/css/style.css new file mode 100644 index 0000000..e69de29 diff --git a/Rashid_Ashfaq/Flaskfundamentals/whatmyName/templates/index.html b/Rashid_Ashfaq/Flaskfundamentals/whatmyName/templates/index.html new file mode 100644 index 0000000..874bbcd --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/whatmyName/templates/index.html @@ -0,0 +1,22 @@ + + + + + + + + + +
+

Enter Your Name.

+
+
+ + + +
+ +
+ + + \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/whatmyName/whatmyName/server.py b/Rashid_Ashfaq/Flaskfundamentals/whatmyName/whatmyName/server.py new file mode 100644 index 0000000..25fbceb --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/whatmyName/whatmyName/server.py @@ -0,0 +1,15 @@ +from flask import Flask, render_template, redirect, request +app = Flask(__name__) + +@app.route("/") +def index(): + return render_template("index.html") + +@app.route("/process", methods=["POST"]) +def process(): + print "Enter your Name" + name= request.form['name'] + print name + return redirect("/") + +app.run(debug=True) \ No newline at end of file diff --git a/Rashid_Ashfaq/Flaskfundamentals/whatmyName/whatmyName/static/css/style.css b/Rashid_Ashfaq/Flaskfundamentals/whatmyName/whatmyName/static/css/style.css new file mode 100644 index 0000000..e69de29 diff --git a/Rashid_Ashfaq/Flaskfundamentals/whatmyName/whatmyName/templates/index.html b/Rashid_Ashfaq/Flaskfundamentals/whatmyName/whatmyName/templates/index.html new file mode 100644 index 0000000..874bbcd --- /dev/null +++ b/Rashid_Ashfaq/Flaskfundamentals/whatmyName/whatmyName/templates/index.html @@ -0,0 +1,22 @@ + + + + + + + + + +
+

Enter Your Name.

+
+
+ + + +
+ +
+ + + \ No newline at end of file diff --git a/Rashid_Ashfaq/MYSQL/blogs.mwb b/Rashid_Ashfaq/MYSQL/blogs.mwb new file mode 100644 index 0000000..7a71bc6 Binary files /dev/null and b/Rashid_Ashfaq/MYSQL/blogs.mwb differ diff --git a/Rashid_Ashfaq/MYSQL/blogs/blogs.mwb b/Rashid_Ashfaq/MYSQL/blogs/blogs.mwb new file mode 100644 index 0000000..7b229cf Binary files /dev/null and b/Rashid_Ashfaq/MYSQL/blogs/blogs.mwb differ diff --git a/Rashid_Ashfaq/MYSQL/blogs/blogs.mwb.bak b/Rashid_Ashfaq/MYSQL/blogs/blogs.mwb.bak new file mode 100644 index 0000000..4e375e4 Binary files /dev/null and b/Rashid_Ashfaq/MYSQL/blogs/blogs.mwb.bak differ diff --git a/Rashid_Ashfaq/MYSQL/books/books.mwb b/Rashid_Ashfaq/MYSQL/books/books.mwb new file mode 100644 index 0000000..1426531 Binary files /dev/null and b/Rashid_Ashfaq/MYSQL/books/books.mwb differ diff --git a/Rashid_Ashfaq/MYSQL/books/books.mwb.bak b/Rashid_Ashfaq/MYSQL/books/books.mwb.bak new file mode 100644 index 0000000..5ada040 Binary files /dev/null and b/Rashid_Ashfaq/MYSQL/books/books.mwb.bak differ diff --git a/Rashid_Ashfaq/MYSQL/countries.sql b/Rashid_Ashfaq/MYSQL/countries.sql new file mode 100644 index 0000000..af977b6 --- /dev/null +++ b/Rashid_Ashfaq/MYSQL/countries.sql @@ -0,0 +1,67 @@ +USE `world`; +/*Q1 What query would you run to get all the countries +that speak Slovene? Your query should return the name of the country, +language and language percentage. Your query should arrange +the result by language percentage in descending order.*/ +SELECT name ,language, percentage FROM countries +JOIN languages +ON languages.country_id = countries.id +WHERE language ='Slovene' +ORDER BY percentage DESC; + +/*Q2* What query would you run to display the total number of +cities for each country? Your query should return the name of the +country and the total number of cities. Your query should arrange the +result by the number of cities in descending order.*/ +SELECT countries.name, COUNT(cities.id) AS cities +FROM countries +JOIN cities ON countries.id = cities.country_id +GROUP BY countries.name +ORDER BY COUNT(cities.id) DESC; + +/*Q3 What query would you run to get all the cities in Mexico with +a population of greater than 500,000? Your query should arrange the +result by population in descending order.*/ +SELECT cities.name,cities.population FROM countries +JOIN cities +ON countries.id= cities.country_id +WHERE countries.name ='Mexico' +AND cities.population > 500000 +ORDER BY population DESC; + +/*Q4 What query would you run to get all languages in each country +with a percentage greater than 89%? Your query should arrange the +result by percentage in descending order. (1)*/ +SELECT countries.name ,languages.language ,languages.percentage FROM countries +JOIN languages +ON countries.id = languages.country_id +WHERE percentage > '89%' +ORDER BY percentage DESC; + +/*Q5 What query would you run to get all the countries with Surface Area below 501 + and Population greater than 100,000? */ + SELECT countries.name, countries.surface_area,countries.population + FROM countries + WHERE countries.surface_area <501 AND countries.population > 100000; + +/*Q6 What query would you run to get countries with only Constitutional Monarchy +with a capital greater than 200 and a life expectancy greater than 75 years?*/ +SELECT countries.name,countries.government_form,countries.capital,countries.life_expectancy +FROM countries WHERE countries.government_form ='Constitutional Monarchy' +AND countries.capital > 200 AND countries.life_expectancy >75; + +/*Q7 What query would you run to get all the cities of Argentina inside +the Buenos Aires district and have the population greater than 500, 000? +The query should return the Country Name, City Name, District and Population.*/ +SELECT countries.name ,cities.name,cities.district,cities.population +FROM countries JOIN cities ON countries.id= cities.country_id +WHERE countries.name = 'Argentina' AND cities.district = 'Buenos Aires' +AND cities.population > 500000 ; + +/*Q8 What query would you run to summarize the number of countries in each region? + The query should display the name of the region and the number of countries. Also, + the query should arrange the result by the number of countries in descending order*/ +SELECT countries.region ,COUNT(countries.id) AS countries +From countries +GROUP BY countries.region +ORDER BY COUNT(countries.id) DESC; diff --git a/Rashid_Ashfaq/MYSQL/sakila.sql b/Rashid_Ashfaq/MYSQL/sakila.sql new file mode 100644 index 0000000..7624dcd --- /dev/null +++ b/Rashid_Ashfaq/MYSQL/sakila.sql @@ -0,0 +1,60 @@ +/*Q1 What query would you run to get all the customers inside city_id = 312? +Your query should return customer first name, last name, email, and address.*/ +SELECT city.city_id ,city.city ,customer.first_name,customer.last_name,customer.email,address.address +FROM city JOIN address ON city.city_id = address.city_id +JOIN customer ON address.address_id = customer.address_id +WHERE city.city_id = 312; + +/*Q2 What query would you run to get all comedy films? Your query should return film title, +description, release year, rating, special features, and genre (category).*/ +SELECT film.film_id,film.title,film.description,film.release_year,film.rating,film.special_features,category.name +FROM film JOIN film_category ON film.film_id = film_category.film_id +JOIN category ON category.category_id = film_category.category_id +WHERE category.name = 'Comedy'; + +/*Q3 What query would you run to get all the films joined by actor_id=5? +Your query should return the actor id, actor name, film title, description, and release year.*/ +SELECT actor.actor_id,CONCAT(actor.first_name,'',actor.last_name) AS actor_name ,film.film_id,film.title,film.description,film.release_year +FROM film JOIN film_actor ON film.film_id = film_actor.film_id +JOIN actor ON actor.actor_id = film_actor.actor_id +WHERE actor.actor_id = 5; + +/*Q4 What query would you run to get all the customers in store_id = 1 and inside these +cities (1, 42, 312 and 459)? Your query should return customer first name, last name, email,and address.*/ +SELECT store.store_id, city.city_id,customer.first_name,customer.last_name,customer.email,address.address +FROM customer JOIN store ON store.store_id = customer.store_id +JOIN address ON address.address_id = customer.address_id +JOIN city ON city.city_id = address.city_id +WHERE customer.store_id = 1 AND city.city_id in (1, 42, 312, 459); + +/*Q5 What query would you run to get all the films with a "rating = G" and "special feature = behind +the scenes", joined by actor_id = 15? Your query should return the film title, description, release year, +rating, and special feature. Hint: You may use LIKE function in getting the 'behind the scenes' part.*/ +SELECT film.title ,film.description,film.release_year,film.rating,film.special_features +FROM film JOIN film_actor ON film.film_id = film_actor.film_id +JOIN actor ON actor.actor_id = film_actor.actor_id +WHERE actor.actor_id = 15 AND film.rating = 'G' AND film.special_features like '%behind the scenes%'; + +/*Q6 What query would you run to get all the actors that joined in the film_id = 3c69? +Your query should return the film_id, title, actor_id, and actor_name.*/ +SELECT film.film_id ,film.title,actor.actor_id,CONCAT(actor.first_name,' ' ,actor.last_name) AS actor_name +FROM film JOIN film_actor ON film.film_id = film_actor.film_id +JOIN actor ON actor.actor_id = film_actor.actor_id +WHERE film.film_id = 369; + +/*Q7 What query would you run to get all drama films with a rental rate of 2.99? +Your query should return film title, description, release year, rating, special features, +and genre (category).*/ +SELECT film.film_id,film.title,film.description,film.release_year,film.rating,film.special_features,category.name AS genre,film.rental_rate +FROM film JOIN film_category ON film.film_id = film_category.film_id +JOIN category ON category.category_id = film_category.category_id +WHERE category.name ='Drama' AND film.rental_rate = 2.99; + +/*Q8* What query would you run to get all the action films which are joined by SANDRA KILMER? +Your query should return film title, description, release year, rating, special features, genre (category), +and actor's first name and last name.*/ +SELECT actor.actor_id,CONCAT(actor.first_name,' ' , actor.last_name)AS actor_name ,film.film_id,film.title,film.description,film.release_year,film.rating,film.special_features,category.name AS genre +FROM film JOIN film_category ON film.film_id= film_category.film_id JOIN category ON category.category_id = film_category.category_id +JOIN film_actor ON film.film_id = film_actor.film_id JOIN actor ON actor.actor_id = film_actor.actor_id +WHERE category.name ='Action' AND actor.first_name = 'SANDRA' AND actor.last_name ='KILMER'; + \ No newline at end of file diff --git a/Rashid_Ashfaq/MYSQL/user_dashboard/User-dashboard.mwb b/Rashid_Ashfaq/MYSQL/user_dashboard/User-dashboard.mwb new file mode 100644 index 0000000..443dd0b Binary files /dev/null and b/Rashid_Ashfaq/MYSQL/user_dashboard/User-dashboard.mwb differ diff --git a/Rashid_Ashfaq/MYSQL/user_dashboard/User-dashboard.mwb.bak b/Rashid_Ashfaq/MYSQL/user_dashboard/User-dashboard.mwb.bak new file mode 100644 index 0000000..ea09e06 Binary files /dev/null and b/Rashid_Ashfaq/MYSQL/user_dashboard/User-dashboard.mwb.bak differ diff --git a/Rashid_Ashfaq/OOP/Animal.py b/Rashid_Ashfaq/OOP/Animal.py new file mode 100644 index 0000000..efeea8f --- /dev/null +++ b/Rashid_Ashfaq/OOP/Animal.py @@ -0,0 +1,54 @@ +class Animal(object): + def __init__(self,name,health): + self.name=name + self.health=health + def walk(self): + self.health -=1 + return self + def run(self): + self.health -=5 + return self + def displayHealth(self): + print "The {} Health: {}".format(self.name,self.health) + return self + +animal1 =Animal('Kitty',120) +animal1.walk().walk().walk() +animal1.run().run() +animal1.displayHealth() +print "--------------------------" + +class Dog(Animal): + def __init__(self,name): + super(Dog,self).__init__(name,150) + #self.health =150 + + def pet(self): + self.health +=5 + return self + +dog1 = Dog("Bulldog") +dog1.walk().walk().walk() +dog1.run().run() +dog1.pet() +dog1.displayHealth() + +print "------------------------------" + + +class Dargon(Animal): + def __init__(self, name): + super(Dargon,self).__init__(name,170) + #self.health = 170 + + def fly(self): + self.health -=10 + return self + + def displayHealth(self): + super(Dargon,self).displayHealth() + print "I am a Dragon" + +dargon1 =Dargon("RedDargon") +dargon1.fly() +dargon1.displayHealth() \ No newline at end of file diff --git a/Rashid_Ashfaq/OOP/MathDojo.py b/Rashid_Ashfaq/OOP/MathDojo.py new file mode 100644 index 0000000..c79119f --- /dev/null +++ b/Rashid_Ashfaq/OOP/MathDojo.py @@ -0,0 +1,21 @@ + +#Part 1: Create a Python class called MathDojo that has the methods +#add and subtract. Have these 2 functions take at least 1 parameter. + +class MathDojo(object): + def __init__(self): + self.result =0 + + def add(self,*num): + for i in num: + self.result+=i + return self + + def subtract(self,*num): + for i in num: + self.result-=i + return self + +md=MathDojo() +print "Result:",md.add(2).add(2,5).subtract(3,2).result + diff --git a/Rashid_Ashfaq/OOP/MathDojop2.py b/Rashid_Ashfaq/OOP/MathDojop2.py new file mode 100644 index 0000000..e480ec3 --- /dev/null +++ b/Rashid_Ashfaq/OOP/MathDojop2.py @@ -0,0 +1,28 @@ +# part 2Modify MathDojo to take at least one integer(s) and/or list(s) +#as a parameter with any number of values passed into the list + +class MathDojo(object): + def __init__(self): + self.result = 0 + + def add(self,*num): + for i in num: + if isinstance(i,int): + self.result+=i + elif isinstance(i,list): + for j in i: + self.result+=j + return self + + def subtract(self,*num): + for i in num: + if isinstance(i,int): + self.result-=i + elif isinstance(i,list): + for j in i: + self.result -=j + return self + +md=MathDojo() +print md.add([1], 3,4).add([3,5,7,8], [2,4.3,1.25]).subtract(2, [2,3], [1.1,2.3]).result + diff --git a/Rashid_Ashfaq/OOP/MathDojotuple.py b/Rashid_Ashfaq/OOP/MathDojotuple.py new file mode 100644 index 0000000..5167204 --- /dev/null +++ b/Rashid_Ashfaq/OOP/MathDojotuple.py @@ -0,0 +1,25 @@ +#Part 3 support Tuple +class MathDojo(object): + def __init__(self): + self.result = 0 + + def add(self,*num): + for i in num: + if isinstance(i,list): + self.result+=i + elif isinstance(i,tuple): + for j in i: + self.result+=j + return self + + def subtract(self,*num): + for i in num: + if isinstance(i,list): + self.result-=i + elif isinstance(i,tuple): + for j in i: + self.result -=j + return self + +md=MathDojo() +print md.add(1, 2).add(3,8,7,9).add((3,3,5)).subtract((4, 2), 5).result \ No newline at end of file diff --git a/Rashid_Ashfaq/OOP/add.py b/Rashid_Ashfaq/OOP/add.py new file mode 100644 index 0000000..fea04d4 --- /dev/null +++ b/Rashid_Ashfaq/OOP/add.py @@ -0,0 +1,34 @@ +class Vehicle(object): + def __init__(self,wheels,capacity,make,model): + self.wheels=wheels + self.capacity=capacity + self.make=make + self.model=model + self.mileage=0 + def drive(self,miles): + self.mileage+=miles + return self + def reserve(self,miles): + self.mileage -=miles + return self +class Bike(Vehicle): + def vehicle_type(self): + return "Bike" +class Car(Vehicle): + def set_wheel(self): + self.wheels=4 + return self +class Airplane(Vehicle): + def fly(self,miles): + self.mileage+=miles + return self +v = Vehicle(8,1,'Rashidmake','Tahirmodle') +print v.make +b =Bike(2,1,'hussainmake','putarimodel') +print b.vehicle_type() +c= Car(4,3,'maker1','modelt1') +c.set_wheel() +print c.wheels +a= Airplane(23,853,'PIA','NY') +a.fly(20) +print a.mileage \ No newline at end of file diff --git a/Rashid_Ashfaq/OOP/bike.py b/Rashid_Ashfaq/OOP/bike.py new file mode 100644 index 0000000..0eb1917 --- /dev/null +++ b/Rashid_Ashfaq/OOP/bike.py @@ -0,0 +1,40 @@ +class Bike(object): + def __init__(self, price, max_speed): + self.price=price + self.max_speed= max_speed + self.miles = 0 + def displayinfo(self): + print "Bike Price " , self.price + print "Bike maxspeed", self.max_speed + print "Bike Milles" , self.miles + + def ride(self): + print "Riding" + self.miles+=10 + + def reverse(self): + print "Reversing" + self.miles-+5 + + + +bike1 = Bike(200,25) +bike1.ride() +bike1.ride() +bike1.ride() +bike1.reverse() +bike1.displayinfo() + +bike2 = Bike(450 , 50) +bike2.ride() +bike2.ride() +bike2.reverse() +bike2.reverse() +bike2.displayinfo() + +bike3 = Bike(345,35) +bike3.reverse() +bike3.reverse() +bike3.reverse() +bike3.displayinfo() + diff --git a/Rashid_Ashfaq/OOP/callCenter.py b/Rashid_Ashfaq/OOP/callCenter.py new file mode 100644 index 0000000..ca32bea --- /dev/null +++ b/Rashid_Ashfaq/OOP/callCenter.py @@ -0,0 +1,64 @@ +class Call(object): + def __init__(self,uniqueId,callerName,callerPhonenum,timeofCall,reasonforCall): + self.uniqueId=uniqueId + self.callerName=callerName + self.callerPhonenum=callerPhonenum + self.timeofCall=timeofCall + self.reasonforCall=reasonforCall + + def display(self): + print "Id #:",self.uniqueId + print "Caller Name:",self.callerName + print "Caller Phone# :",self.callerPhonenum + print "Time Of Call :",self.timeofCall + print "Reason for Call :",self.reasonforCall + return self + +call1= Call(1,'rashid','3476058728','12:30am','Internet not working') +call1.display() + +class CallCenter(object): + def __init__(self): + self.calllist=[] + self.queuesize =0 + + def add(self,call): + self.calllist.append(call) + self.queuesize +=1 + + def remove(self): + if len(self.calllist)>0: + self.calllist.pop(0) + self.queuesize -=1 + + def info(self): + for i in self.calllist: + print "Caller Id :", str(i.uniqueId) + print "Caller Name ", str(i.callerName) + print "Caller Phone#", str(i.callerPhonenum) + print "lenght of call ",self.queuesize + +#Ninja Level def removePhone(self,num): + + + + +#Hacker Level def sortCallerList(self,) + +call2 =Call(3,'Sawan','9807654345','11:00AM', 'NetWork is not Working') +call3 = Call(4, 'lee','4073481098',"12:00PM", 'Gps not Working') +call4 =Call(2,'William','2345679876','1:00AM','Sim Activation') +call5 = Call(5, 'mikal','3456789021','3:00PM', 'Information') + +call2.display() + +callcenter1 = CallCenter() +callcenter1.add(call2) +callcenter1.add(call3) +callcenter1.add(call4) +callcenter1.add(call5) +callcenter1.info() + + + + diff --git a/Rashid_Ashfaq/OOP/car.py b/Rashid_Ashfaq/OOP/car.py new file mode 100644 index 0000000..b0955f6 --- /dev/null +++ b/Rashid_Ashfaq/OOP/car.py @@ -0,0 +1,26 @@ +class Car(object): + def __init__(self, price,speed,fuel,mileage): + self.price=price + self.speed=speed + self.fuel=fuel + self.mileage=mileage + if price >10000: + self.tax = 0.15 + else: + self.tax= 0.12 + self.display_all() + + + def display_all(self): + print 'Price' ,self.price + print 'Speed',self.speed + print 'Fuel',self.fuel + print 'Milage',self.mileage + print 'Tax' ,self.tax + +car1 = Car(2000, 35,'FULL',15) +car2 = Car(2000, 5, 'Not Full',105) +car3 = Car(2000, 15,'Kind of Full',95) +car4 = Car(2000, 25,'Full', 25) +car5 = Car(2000,45,"Empty",25) +car5 = Car(20000000, 35,'Empty',15) diff --git a/Rashid_Ashfaq/OOP/moduletest.py b/Rashid_Ashfaq/OOP/moduletest.py new file mode 100644 index 0000000..68fb12c --- /dev/null +++ b/Rashid_Ashfaq/OOP/moduletest.py @@ -0,0 +1,6 @@ +def add(x,y): + return x+y +def multiply(x,y): + return x*y +def subtract(x,y): + return x-y \ No newline at end of file diff --git a/Rashid_Ashfaq/OOP/product.py b/Rashid_Ashfaq/OOP/product.py new file mode 100644 index 0000000..368b0af --- /dev/null +++ b/Rashid_Ashfaq/OOP/product.py @@ -0,0 +1,37 @@ +class Product(object): + def __init__(self,price,item_name,weight,brand): + self.price=price + self.item_name=item_name + self.brand=brand + self.weight=weight + self.status="for sale" + + def sellStatus(self): + self.status="sold" + + def addTax(self,tax): + self.price= self.price +tax + return self.price + + def returnProduct(self,reason): + if reason == "defective": + self.status="defective" + self.price=0 + elif reason == "in the box": + self.status= "for sale" + elif reason == "open box": + self.status="used" + self.price-=self.price*0.20 + + def showallproduct(self): + print "Product Price :", self.price + print "Product Name :" ,self.item_name + print "Product Weight:", self.weight + print "Product.Brand:" , self.brand + print "Product.status" , self.status + +product1 = Product(650 ,"iPhone", "apple", "3pounds") +product1.showallproduct() +product1.addTax(3) +product1.returnProduct("open box") +product1.sellStatus() diff --git a/Rashid_Ashfaq/Python_fundamental/Find-and-Replace.py b/Rashid_Ashfaq/Python_fundamental/Find-and-Replace.py new file mode 100644 index 0000000..8a86be6 --- /dev/null +++ b/Rashid_Ashfaq/Python_fundamental/Find-and-Replace.py @@ -0,0 +1,7 @@ +words ="It's thanksgiving day.It's my birthday,tool!" +index = words.find('day') +print "index of Day = " ,index +18 +newstr= 'month' +print words.replace("day",newstr) +It's thanksgiving month.It's my birthmonth,tool! diff --git a/Rashid_Ashfaq/Python_fundamental/namedicpart2.py b/Rashid_Ashfaq/Python_fundamental/namedicpart2.py new file mode 100644 index 0000000..7248c5d --- /dev/null +++ b/Rashid_Ashfaq/Python_fundamental/namedicpart2.py @@ -0,0 +1,27 @@ +users ={ +'Student':[ + {'first_name':'Michael','last_name':'Jordan'}, + {'first_name': 'John', 'last_name': 'Rosales'}, + {'first_name': 'MArk', 'last_name': 'Guillen'}, + {'first_name': 'KB', 'last_name': 'Tonel'} + ], +'Instructor':[ + {'first_name': 'Michael','last_name':'Choi'}, + {'first_name': 'Martin', 'last_name':'Puryear'} +] +} +def userdisply(): + studentcount =0 + Instructorcount = 0 + print "Students" + for key in users['Student']: + student_length = len(key['first_name'])+ len(key['last_name']) + studentcount= studentcount+1 + print studentcount , "-", key['first_name'],key['last_name'] ,"-" , student_length + print "Instructor" + for key1 in users['Instructor']: + Instructor_length =len(key1['first_name']) + len(key1['last_name']) + Instructorcount= Instructorcount+1 + print Instructorcount , "-" , key1['first_name'],key1['last_name'] ,"-", Instructor_length + +userdisply() \ No newline at end of file diff --git a/Rashid_Ashfaq/Python_fundamental/tuples.py b/Rashid_Ashfaq/Python_fundamental/tuples.py new file mode 100644 index 0000000..90858e6 --- /dev/null +++ b/Rashid_Ashfaq/Python_fundamental/tuples.py @@ -0,0 +1,11 @@ +my_dict ={ + "Speros": "(555) 555-5555", + "Michael": "(999) 999-999", + "Jay": "(777) 777-7777" +} +def maketuples(dic): + tuples = dic.items() + print tuples + + +maketuples(my_dict) \ No newline at end of file diff --git a/Rashid_Ashfaq/Python_fundamental/type_list.py b/Rashid_Ashfaq/Python_fundamental/type_list.py new file mode 100644 index 0000000..36ca6fe --- /dev/null +++ b/Rashid_Ashfaq/Python_fundamental/type_list.py @@ -0,0 +1,15 @@ +l = ['magical unicorns',19,'hello',98.98,'world'] +sum=0 +string='' +data = [False,False] +for i in l: + if isinstance(i,float) or isinstance(i,int): + sum+=i + data[0]=True + else: + string+= i + ' ' + data[1]=True + +if all(data):print "The array you entered is of mixed String",(string.strip(),sum) +elif data[1]:print "The array you entered is of string =",string.strip() +elif data[0]:print "The array you entered is of Sum =/n",sum

Submitedt Info

Name:{{name}}
Location:{{location}}
Language: {{language}}
Comment:{{comment}}
+ +