├── .idea ├── .name ├── PythonTutorial.iml ├── encodings.xml ├── misc.xml ├── modules.xml ├── vcs.xml └── workspace.xml ├── Dictionary.py ├── LoopControl.py ├── OOPBasicClass.py ├── OOPInhertance.py ├── OOPKwarges.py ├── OOPOverride.py ├── OOPconstructors.py ├── README.md ├── Regpython.py ├── TuplesAndList.py ├── __pycache__ └── OOPBasicClass.cpython-35.pyc ├── condition_if_simple.py ├── conditional_if_elif.py ├── conditional_if_else.py ├── conditional_nested_if.py ├── database.py ├── exceptions.py ├── function.py ├── httpcalls.py ├── information.db ├── loop_While.py ├── loops_for.py ├── loops_nested_loop.py ├── main.py ├── model.py ├── myFile.py ├── my_age.py ├── objects.py ├── regFile.txt ├── snaped.txt ├── test.txt ├── variables.py └── welcome.py /.idea/.name: -------------------------------------------------------------------------------- 1 | PythonTutorial -------------------------------------------------------------------------------- /.idea/PythonTutorial.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 20 | 21 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 138 | 139 | 140 | 142 | 143 | 181 | 182 | 183 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 220 | 221 | 222 | 223 | 226 | 227 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 275 | 276 | 292 | 293 | 309 | 310 | 326 | 327 | 343 | 344 | 360 | 361 | 379 | 380 | 398 | 399 | 419 | 420 | 441 | 442 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 1466898649203 487 | 490 | 491 | 1466906863234 492 | 496 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 526 | 527 | 528 | 530 | 531 | 532 | 533 | 534 | file://$PROJECT_DIR$/condition_if_simple.py 535 | 1 536 | 538 | 539 | file://$PROJECT_DIR$/conditional_nested_if.py 540 | 2 541 | 543 | 544 | 545 | 546 | 547 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | 885 | 886 | 887 | 888 | 889 | 890 | 891 | 892 | 893 | 894 | 895 | 896 | 897 | 898 | 899 | 900 | 901 | 902 | 903 | 904 | 905 | 906 | 907 | 908 | 909 | 910 | 911 | 912 | 913 | 914 | 915 | 916 | 917 | 918 | 919 | 920 | 921 | 922 | 923 | 924 | 925 | 926 | -------------------------------------------------------------------------------- /Dictionary.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | def main(): 5 | #Student={'Name':"hussein alrubaye",'Age':27,'Slary':232.5}; 6 | Student=dict(Name="hussein alrubaye",Age=27,Slary=232.5); 7 | Student['Name']="Hussein Ahmed" 8 | Student["Dept"]="software engineer" 9 | print(Student,type(Student)) 10 | del Student["Dept"] 11 | print(Student,type(Student)) 12 | print(Student['Name']) 13 | print(Student['Age']) 14 | Student.clear() 15 | print(Student,type(Student)) 16 | 17 | 18 | 19 | 20 | if __name__ == '__main__':main() 21 | -------------------------------------------------------------------------------- /LoopControl.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | def main(): 6 | word="python" 7 | for letter in word: 8 | if(letter=='t'): 9 | pass 10 | print(" blcok is padded") 11 | print(letter) 12 | print("progam end") 13 | 14 | 15 | if __name__ == '__main__':main() 16 | -------------------------------------------------------------------------------- /OOPBasicClass.py: -------------------------------------------------------------------------------- 1 | 2 | class Car: 3 | def GetOwner(self): 4 | print("Owner is ",self._Name) 5 | def SetOwner(self,Name): 6 | self._Name=Name 7 | 8 | 9 | 10 | def main(): 11 | mycar=Car() 12 | mycar.SetOwner("Hussein Alrubaye") 13 | mycar.GetOwner() 14 | Jencar=Car() 15 | Jencar.SetOwner("Jen Alrubaye") 16 | Jencar.GetOwner() 17 | 18 | 19 | 20 | if __name__ == '__main__':main() -------------------------------------------------------------------------------- /OOPInhertance.py: -------------------------------------------------------------------------------- 1 | class Operation: 2 | def Sum(self,n1,n2): 3 | SumResult=n1+n2 4 | print("Sum=",SumResult) 5 | def Sub(self,n1,n2): 6 | SubResult=n1-n2 7 | print("Sub=",SubResult) 8 | class OperationWithMul(Operation): 9 | 10 | def Mul(self,n1,n2): 11 | MulResult=n1*n2 12 | print("Mul=",MulResult) 13 | 14 | 15 | def main(): 16 | #OP=Operation() 17 | #OP.Sub(4,2) 18 | #OP.Sum(10,15) 19 | OpMul=OperationWithMul(); 20 | OpMul.Sub(4,2) 21 | OpMul.Sum(10,15) 22 | OpMul.Mul(10,2) 23 | 24 | 25 | 26 | 27 | 28 | if __name__ == '__main__':main() 29 | -------------------------------------------------------------------------------- /OOPKwarges.py: -------------------------------------------------------------------------------- 1 | 2 | class Car: 3 | def __init__(self,**kwargs): 4 | self.Data=kwargs 5 | def GetOwner(self): 6 | print("Owner Name ",self.Data["Name"]) 7 | print("Car Model ",self.Data["Model"]) 8 | print("Year ",self.Data["Year"]) 9 | def Set_Model(self,Model): 10 | self.Data["Model"]=Model 11 | def Get_Model(self): 12 | print("Car Model ",self.Data["Model"]) 13 | 14 | 15 | 16 | 17 | def main(): 18 | mycar=Car(Name="Hussein Alrubaye",Model="camer 2015",Year=2015) 19 | mycar.GetOwner() 20 | Jencar=Car(Name="Jen Alrubaye",Model="sony x",Year=2015) 21 | Jencar.GetOwner() 22 | #jen model set 23 | Jencar.Set_Model("2016") 24 | Jencar.Get_Model() 25 | 26 | 27 | 28 | if __name__ == '__main__':main() -------------------------------------------------------------------------------- /OOPOverride.py: -------------------------------------------------------------------------------- 1 | class Operation: 2 | def Sum(self,n1,n2): 3 | SumResult=n1+n2 4 | print("Sum=",SumResult) 5 | def Sub(self,n1,n2): 6 | SubResult=n1-n2 7 | print("Sub=",SubResult) 8 | class OperationWithMul(Operation): 9 | 10 | def Mul(self,n1,n2): 11 | MulResult=n1*n2 12 | print("Mul=",MulResult) 13 | def Sub(self,n1,n2): 14 | super().Sub(n1,n2) 15 | #SubResult=n1-n2+5 16 | #print("Sub=",SubResult) 17 | 18 | 19 | def main(): 20 | #OP=Operation() 21 | #OP.Sub(4,2) 22 | #OP.Sum(10,15) 23 | OpMul=OperationWithMul(); 24 | OpMul.Sub(4,2) 25 | OpMul.Sum(10,15) 26 | OpMul.Mul(10,2) 27 | 28 | 29 | 30 | 31 | 32 | if __name__ == '__main__':main() 33 | -------------------------------------------------------------------------------- /OOPconstructors.py: -------------------------------------------------------------------------------- 1 | 2 | class Car: 3 | def __init__(self,Name): 4 | self._Name=Name 5 | def GetOwner(self): 6 | print("Owner is ",self._Name) 7 | 8 | 9 | 10 | 11 | def main(): 12 | mycar=Car("Hussein Alrubaye") 13 | mycar.GetOwner() 14 | Jencar=Car("Jen Alrubaye") 15 | Jencar.GetOwner() 16 | 17 | 18 | 19 | if __name__ == '__main__':main() -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Python Tutorial essential Training 2 | ### This code is snapped code for Python UDMEY course.Watch using a [ FREE on Youtube](https://www.youtube.com/watch?v=cK1D7AlDgfw&t=41s). 3 | To make the learn and writing code easy 4 | 5 | 6 | ## Course Description 7 | 8 | This course for anyone who want to be Python programmer from scratch, We will start by discus all programming fundamentals that you need to start programming Python. We will start first by install the development environment then you will run your first Python app, and understand how program flow works in Python. Then we will talk about variables and Math operation and proirites. Then we will take about logic and making decision, then we will talk about loops. Then we will talk about how to work with Sqlite database and files.Then we will talk about functions and OOP concept that you need to use when you program apps with Python, then we will talk about multi-processing and how you could run multi-process in same time, then we will talk about Databases, then we will talk about collections and which type collection you have to use for better performance depend on your app. Then we will talk about how to read JSON from HTTP URL, then we will talk about build desktop GUI application with custom user experiences with UI apps . Finally we will build complete games and apps like Tic Tac Toy and Ticket reservation 9 | 10 | ![main](http://attach.alruabye.net/dsa/dsa.jpg) 11 | -------------------------------------------------------------------------------- /Regpython.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | import re 5 | def main(): 6 | 7 | readFile=open("regFile.txt","r") 8 | for line in readFile: 9 | if re.search("(Sa|Ha)na",line): 10 | print(line) 11 | readFile.close() 12 | 13 | 14 | 15 | if __name__ == '__main__':main() 16 | -------------------------------------------------------------------------------- /TuplesAndList.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | def main(): 4 | #string 5 | Data="software engineer" 6 | print(Data[0:5]) 7 | #List 8 | Ages=[44,33,45,33,54] 9 | Ages.append(100) 10 | Ages.insert(0,33) 11 | print(Ages) 12 | #Tuples 13 | Ages=[44,33,45,33,54] 14 | Ages.append(100) 15 | Ages.insert(0,33) 16 | print(Ages) 17 | 18 | 19 | 20 | if __name__ == '__main__':main() 21 | -------------------------------------------------------------------------------- /__pycache__/OOPBasicClass.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hussien89aa/PythonTutorial/38a1111e46e82237f53634a269a23346656af901/__pycache__/OOPBasicClass.cpython-35.pyc -------------------------------------------------------------------------------- /condition_if_simple.py: -------------------------------------------------------------------------------- 1 | def main(): 2 | Age=input("enter your Age:") 3 | if(int(Age)>18): 4 | print("welcome") 5 | 6 | 7 | 8 | 9 | 10 | if __name__ == '__main__':main() -------------------------------------------------------------------------------- /conditional_if_elif.py: -------------------------------------------------------------------------------- 1 | def main(): 2 | Age=input("enter your Age:") 3 | if(int(Age)>=8 and int(Age)<=10): 4 | print("children") 5 | print("children") 6 | print("children") 7 | print("children") 8 | elif(int(Age)>=11 and int(Age)<=15): 9 | print("kids") 10 | elif(int(Age)>=16 and int(Age)<=18): 11 | print("Tingers") 12 | elif(int(Age)>=19 and int(Age)<=30): 13 | print("Young") 14 | else: 15 | print("Out of range") 16 | print("End") 17 | 18 | 19 | 20 | 21 | 22 | if __name__ == '__main__':main() -------------------------------------------------------------------------------- /conditional_if_else.py: -------------------------------------------------------------------------------- 1 | def main(): 2 | Age=input("enter your Age:") 3 | if(int(Age)>18): 4 | print("welcome") 5 | else: 6 | print("Not Welcome") 7 | 8 | 9 | 10 | 11 | 12 | 13 | if __name__ == '__main__':main() -------------------------------------------------------------------------------- /conditional_nested_if.py: -------------------------------------------------------------------------------- 1 | def main(): 2 | Degree=input("enter your Degree:") 3 | if(int(Degree)>=90 ): 4 | print("hi") 5 | x=5 6 | if(int(Degree)>94): 7 | print("Your Score is +A") 8 | else: 9 | print("Your Score is -A") 10 | elif(int(Degree)>=80 and int(Degree)<=89): 11 | print("Your Score is B") 12 | elif(int(Degree)>=70 and int(Degree)<=79): 13 | print("Your Score is C") 14 | elif(int(Degree)>=60 and int(Degree)<=69): 15 | print("Your Score is D") 16 | elif(int(Degree)>=50 and int(Degree)<=59): 17 | print("Your Score is E") 18 | else: 19 | print("You Fail") 20 | 21 | 22 | if __name__ == '__main__':main() -------------------------------------------------------------------------------- /database.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | import sqlite3 6 | 7 | def main(): 8 | db=sqlite3.connect("information.db") 9 | db.row_factory=sqlite3.Row 10 | db.execute("create table if not exists Admin(Name text,age int)") 11 | db.execute("insert into Admin (Name,age) values (? , ?)",("Hussein",26)) 12 | db.execute("insert into Admin (Name,age) values (? , ?)",("Jena",1)) 13 | db.commit() 14 | #db.execute("delete from Admin where name='Jena'") 15 | #db.execute("Update Admin set age=2 where name='Jena'") 16 | cusror=db.execute("select * from Admin") 17 | for row in cusror: 18 | print("Name:{}, Age:{}".format(row["Name"],row["age"])) 19 | 20 | 21 | 22 | 23 | if __name__ == '__main__':main() 24 | -------------------------------------------------------------------------------- /exceptions.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | def main(): 6 | try: 7 | readFile=open("test.txt","r") 8 | for line in readFile: 9 | print(line) 10 | readFile.close() 11 | except IOError: 12 | print("File not found") 13 | else: 14 | print("File is readed") 15 | 16 | 17 | 18 | if __name__ == '__main__':main() 19 | -------------------------------------------------------------------------------- /function.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | def SumNumbers(n1,n2): 4 | z=n1+n2 5 | return z 6 | 7 | 8 | def main(): 9 | result= SumNumbers(3,5) 10 | print("z={}".format(result)) 11 | 12 | 13 | 14 | 15 | if __name__ == '__main__':main() 16 | -------------------------------------------------------------------------------- /httpcalls.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | import urllib.request,json 6 | def main(): 7 | data=urllib.request.urlopen("http://selling.alruabye.net/UsersWS.asmx/GetToolType?lng=ar").read() 8 | jsonr=json.loads(data.decode("utf-8")) 9 | #print(jsonr,type(jsonr)) 10 | for row in jsonr['ToolData']: 11 | print(row['ToolTypeName']) 12 | 13 | 14 | 15 | if __name__ == '__main__':main() 16 | -------------------------------------------------------------------------------- /information.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hussien89aa/PythonTutorial/38a1111e46e82237f53634a269a23346656af901/information.db -------------------------------------------------------------------------------- /loop_While.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | def main(): 6 | print("program start") 7 | i=1 8 | while(i<100): 9 | if(i% 4==0): 10 | print("Count {}".format(i)) 11 | i+=1 12 | 13 | print("progarm end") 14 | 15 | 16 | 17 | if __name__ == '__main__':main() 18 | -------------------------------------------------------------------------------- /loops_for.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | def main(): 6 | l=[1,3,4,'hi',3.4] 7 | print(range(5)) 8 | for i in range(5): 9 | print(l[i]) 10 | 11 | 12 | 13 | 14 | 15 | if __name__ == '__main__':main() 16 | -------------------------------------------------------------------------------- /loops_nested_loop.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | def main(): 6 | i=0 7 | while(i<5): 8 | print("i={}".format(i)) 9 | i+=1 10 | j=5 11 | while(j>i): 12 | print("j={}".format(j)) 13 | j-=1 14 | 15 | 16 | 17 | 18 | if __name__ == '__main__':main() 19 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | def main(): 6 | print("hello from python") 7 | print("next line execute") 8 | 9 | 10 | if __name__ == '__main__':main() 11 | -------------------------------------------------------------------------------- /model.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | import OOPBasicClass 6 | def main(): 7 | car=OOPBasicClass.Car() 8 | car._Name="Alxs" 9 | car.GetOwner() 10 | car.SetOwner("Ahmed") 11 | car.GetOwner() 12 | 13 | 14 | 15 | if __name__ == '__main__':main() 16 | -------------------------------------------------------------------------------- /myFile.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | def main(): 6 | out=open("test.txt","a") 7 | out.write(" \nname:salama") 8 | out.write(" \nname:dema") 9 | out.close() 10 | readFile=open("test.txt","r") 11 | for line in readFile: 12 | print(line) 13 | readFile.close() 14 | 15 | 16 | 17 | if __name__ == '__main__':main() 18 | -------------------------------------------------------------------------------- /my_age.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | 3 | def main(): 4 | DOB=input("Enter your DOB:") 5 | YearNow=datetime.datetime.now().year 6 | MyAge=YearNow-int(DOB) 7 | print("Your age is {} Year".format(MyAge)) 8 | 9 | 10 | 11 | 12 | if __name__ == '__main__':main() -------------------------------------------------------------------------------- /objects.py: -------------------------------------------------------------------------------- 1 | 2 | Name="hussein" 3 | print(Name,type(Name)) 4 | Age=22 5 | print(Age,type(Age)) 6 | Slary=12544.5 7 | print(Slary,type(Slary)) 8 | -------------------------------------------------------------------------------- /regFile.txt: -------------------------------------------------------------------------------- 1 | name:Ahmed 2 | name:Jena 3 | name:salama 4 | name:Hussein Alrubaye 5 | name:Sana Alrubaye 6 | name:Hana -------------------------------------------------------------------------------- /snaped.txt: -------------------------------------------------------------------------------- 1 | db=sqlite3.connect("test.db") 2 | db.row_factory = sqlite3.Row 3 | db.execute("create table if not exists Admin(name text,age int)") 4 | db.execute("insert into Admin (name,age) values (?, ?)",("hussein",27)) 5 | #db.execute('insert into Admin (name, age) values (?, ?)', (row['t1'], row['i1'])) 6 | print("hello from python") 7 | print("next line execute") 8 | cursor=db.execute("select * from Admin") 9 | for row in cursor: 10 | print(' {}: {}'.format(row['name'], row['age'])) -------------------------------------------------------------------------------- /test.txt: -------------------------------------------------------------------------------- 1 | 2 | name:salama 3 | name:dema 4 | -------------------------------------------------------------------------------- /variables.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | def main(): 4 | 5 | Amount=30 #amount of time spend on working 6 | data="{} is high".format(Amount) # format my data 7 | #data="%s is high"% Amount 8 | print(data,type(data)) 9 | datalen="is good" 10 | print(len(datalen)) 11 | print(datalen[1]) 12 | 13 | 14 | 15 | 16 | 17 | 18 | if __name__ == '__main__':main() 19 | -------------------------------------------------------------------------------- /welcome.py: -------------------------------------------------------------------------------- 1 | 2 | print('welcome to python') --------------------------------------------------------------------------------