3712
3712
"execution_count" : 2
3713
3713
}
3714
3714
]
3715
+ },
3716
+ {
3717
+ "cell_type" : " code" ,
3718
+ "source" : [
3719
+ " k = 1\n " ,
3720
+ " s = 0\n " ,
3721
+ " while k <= 15:\n " ,
3722
+ " s = s + 2 * k\n " ,
3723
+ " k = k + 1\n " ,
3724
+ " print(s)"
3725
+ ],
3726
+ "metadata" : {
3727
+ "colab" : {
3728
+ "base_uri" : " https://localhost:8080/"
3729
+ },
3730
+ "id" : " dMVA08wmPKXp" ,
3731
+ "outputId" : " 7388967b-6add-4348-b073-9f4a7762b309"
3732
+ },
3733
+ "execution_count" : 2 ,
3734
+ "outputs" : [
3735
+ {
3736
+ "output_type" : " stream" ,
3737
+ "name" : " stdout" ,
3738
+ "text" : [
3739
+ " 240\n "
3740
+ ]
3741
+ }
3742
+ ]
3743
+ },
3744
+ {
3745
+ "cell_type" : " code" ,
3746
+ "source" : [
3747
+ " s = 0\n " ,
3748
+ " x = 8762\n " ,
3749
+ " while x > 0:\n " ,
3750
+ " if x % 2 == 0:\n " ,
3751
+ " s += x % 10\n " ,
3752
+ " x //= 10\n " ,
3753
+ " print(s)"
3754
+ ],
3755
+ "metadata" : {
3756
+ "colab" : {
3757
+ "base_uri" : " https://localhost:8080/"
3758
+ },
3759
+ "id" : " bgH1VziYPhaF" ,
3760
+ "outputId" : " fd677995-c915-4d39-dc04-fac85d44b021"
3761
+ },
3762
+ "execution_count" : 4 ,
3763
+ "outputs" : [
3764
+ {
3765
+ "output_type" : " stream" ,
3766
+ "name" : " stdout" ,
3767
+ "text" : [
3768
+ " 16\n "
3769
+ ]
3770
+ }
3771
+ ]
3772
+ },
3773
+ {
3774
+ "cell_type" : " code" ,
3775
+ "source" : [
3776
+ " A = [0] * 11\n " ,
3777
+ " for i in range(0, 11):\n " ,
3778
+ " A[i] = i + 1\n " ,
3779
+ " print(' '.join(map(str, A)))"
3780
+ ],
3781
+ "metadata" : {
3782
+ "colab" : {
3783
+ "base_uri" : " https://localhost:8080/"
3784
+ },
3785
+ "id" : " _FxZSkxBYuX9" ,
3786
+ "outputId" : " 2243516a-68e2-48d3-875e-64a76bf6ea01"
3787
+ },
3788
+ "execution_count" : 8 ,
3789
+ "outputs" : [
3790
+ {
3791
+ "output_type" : " stream" ,
3792
+ "name" : " stdout" ,
3793
+ "text" : [
3794
+ " 1 2 3 4 5 6 7 8 9 10 11\n "
3795
+ ]
3796
+ }
3797
+ ]
3798
+ },
3799
+ {
3800
+ "cell_type" : " code" ,
3801
+ "source" : [
3802
+ " A = [9, 4, 6, 1, 2, 4, 3, 8, 0, 5]\n " ,
3803
+ " A[1:6:2]"
3804
+ ],
3805
+ "metadata" : {
3806
+ "colab" : {
3807
+ "base_uri" : " https://localhost:8080/"
3808
+ },
3809
+ "id" : " 1LzHXR9zZCe4" ,
3810
+ "outputId" : " 1dd87043-3e1a-4254-b558-983fc060a46c"
3811
+ },
3812
+ "execution_count" : 1 ,
3813
+ "outputs" : [
3814
+ {
3815
+ "output_type" : " execute_result" ,
3816
+ "data" : {
3817
+ "text/plain" : [
3818
+ " [4, 1, 4]"
3819
+ ]
3820
+ },
3821
+ "metadata" : {},
3822
+ "execution_count" : 1
3823
+ }
3824
+ ]
3825
+ },
3826
+ {
3827
+ "cell_type" : " code" ,
3828
+ "source" : [
3829
+ " D = [1, 2, 5, 9, 2, 7, 8, 2, 6, 6, 0, 2]\n " ,
3830
+ " a = D.count(2)\n " ,
3831
+ " b = D.index(6)\n " ,
3832
+ " print(a + b)"
3833
+ ],
3834
+ "metadata" : {
3835
+ "colab" : {
3836
+ "base_uri" : " https://localhost:8080/"
3837
+ },
3838
+ "id" : " VPg6n4dnZT0I" ,
3839
+ "outputId" : " 2d1a2dc3-2b50-4947-9d66-ab2b4ab9ccb9"
3840
+ },
3841
+ "execution_count" : 2 ,
3842
+ "outputs" : [
3843
+ {
3844
+ "output_type" : " stream" ,
3845
+ "name" : " stdout" ,
3846
+ "text" : [
3847
+ " 12\n "
3848
+ ]
3849
+ }
3850
+ ]
3851
+ },
3852
+ {
3853
+ "cell_type" : " code" ,
3854
+ "source" : [
3855
+ " M = [34, 765, 1, 45, 9, 83, 22]\n " ,
3856
+ " M.insert(2, 3)\n " ,
3857
+ " M.append(55)\n " ,
3858
+ " M.reverse()\n " ,
3859
+ " print(*M)"
3860
+ ],
3861
+ "metadata" : {
3862
+ "colab" : {
3863
+ "base_uri" : " https://localhost:8080/"
3864
+ },
3865
+ "id" : " 5YRHUiBXZiqZ" ,
3866
+ "outputId" : " ddfc0f79-94d9-4120-9703-6c3f2a57424a"
3867
+ },
3868
+ "execution_count" : 3 ,
3869
+ "outputs" : [
3870
+ {
3871
+ "output_type" : " stream" ,
3872
+ "name" : " stdout" ,
3873
+ "text" : [
3874
+ " 55 22 83 9 45 1 3 765 34\n "
3875
+ ]
3876
+ }
3877
+ ]
3878
+ },
3879
+ {
3880
+ "cell_type" : " code" ,
3881
+ "source" : [
3882
+ " С = [9, 8, 7, 6, 5, 4, 3]\n " ,
3883
+ " С.pop(0)\n " ,
3884
+ " print(' '.join(map(str, С)))"
3885
+ ],
3886
+ "metadata" : {
3887
+ "colab" : {
3888
+ "base_uri" : " https://localhost:8080/"
3889
+ },
3890
+ "id" : " v1hRvMw0Zo3I" ,
3891
+ "outputId" : " 14b32f51-6db0-4c9e-8363-c9a5468922b8"
3892
+ },
3893
+ "execution_count" : 6 ,
3894
+ "outputs" : [
3895
+ {
3896
+ "output_type" : " stream" ,
3897
+ "name" : " stdout" ,
3898
+ "text" : [
3899
+ " 8 7 6 5 4 3\n "
3900
+ ]
3901
+ }
3902
+ ]
3903
+ },
3904
+ {
3905
+ "cell_type" : " code" ,
3906
+ "source" : [
3907
+ " s = 'hello'\n " ,
3908
+ " t = 'world'\n " ,
3909
+ " w = (s + ' ' + t) * 2\n " ,
3910
+ " print(len(w))"
3911
+ ],
3912
+ "metadata" : {
3913
+ "colab" : {
3914
+ "base_uri" : " https://localhost:8080/"
3915
+ },
3916
+ "id" : " etNM_08DlICi" ,
3917
+ "outputId" : " 4cd20542-d4af-41bc-d743-ccd92bf037bd"
3918
+ },
3919
+ "execution_count" : 7 ,
3920
+ "outputs" : [
3921
+ {
3922
+ "output_type" : " stream" ,
3923
+ "name" : " stdout" ,
3924
+ "text" : [
3925
+ " 22\n "
3926
+ ]
3927
+ }
3928
+ ]
3929
+ },
3930
+ {
3931
+ "cell_type" : " code" ,
3932
+ "source" : [
3933
+ " s = 'abracadabra'\n " ,
3934
+ " s[1] + s[-4] + s[2:5]"
3935
+ ],
3936
+ "metadata" : {
3937
+ "colab" : {
3938
+ "base_uri" : " https://localhost:8080/" ,
3939
+ "height" : 35
3940
+ },
3941
+ "id" : " cAa_sO4ulNRf" ,
3942
+ "outputId" : " 5d9e9f26-ba82-4b13-d404-564c30898fea"
3943
+ },
3944
+ "execution_count" : 8 ,
3945
+ "outputs" : [
3946
+ {
3947
+ "output_type" : " execute_result" ,
3948
+ "data" : {
3949
+ "text/plain" : [
3950
+ " 'barac'"
3951
+ ],
3952
+ "application/vnd.google.colaboratory.intrinsic+json" : {
3953
+ "type" : " string"
3954
+ }
3955
+ },
3956
+ "metadata" : {},
3957
+ "execution_count" : 8
3958
+ }
3959
+ ]
3715
3960
}
3716
3961
]
3717
3962
}
0 commit comments