Giter Club home page Giter Club logo

python-exercises-beginner's Introduction

python-exercises-beginner

This is a collection of all the python Exercises I've Completed!

These are all the programs and scripts and projects in the beginner section!


These are the commands and keywords learnt and used:

*.lower()-lowercase all

*.upper()-uppercase all

*{:.2f}- format specifier in fstring than has accuracy of 2 decimal points

*.format()-to format strings

"".join(list)- prints a list as a string. list elements must be a string. so if not convert each to string first using str(i) for i in list for eg

you can concatenate lists using + operator .

Empty variable declarations


empty_string = ""

empty_dict = {}

empty_set = set()

empty_tuple = ()

*if:
....
elif:
.....
else:
.....

*print(" ")-print single line to display

*print(''' ...... ''')-multiline print to display

*input("display statement")- get input

*int()-typecast int

*float()-typecast float

*str()-typecast str

*len()- returns the size of a list

*.extend("data")- adds the elements mentioned to the end of the list

*append()-appends or attaches at the end of the list



$-$-$-import random-$-$-$

random.randint(int a, int b)-produces random number between a and b provided a < b

random.random(0.000,0.9999)- for float random numbers . you mulitply by the range i.e for 1-5 float number randomvariable*5

random.choice(list)- will pick a random element from the list

random.sample(list, number of elements in new list)-creates a new list and with shuffled elements

random.shuffle(list)-shuffles the list in place i.e. original list is overwritten by new list



python-exercises-beginner's People

Contributors

rahul109866 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.