Lecture : Here are some basic starting codes in Python

7 views2 pages

Document Summary

This is the most basic program in any programming language. World!" to the console. bashcopy code print ( "hello, world!: variables: Variables are used to store data in a program. Here"s an example of how to create a variable and assign it a value. scsscopy code x = 5 print (x: input: The input function is used to take input from the user. Here"s an example of how to take input from the user and store it in a variable. luacopy code name = input ( "what is your name? " ) print ( "hello, " + name + "!: if-else statement: The if-else statement is used to make decisions in a program based on certain conditions. Here"s an example of how to use an if-else statement. pythoncopy code age = int ( input ( "how old are you? " )) if age >= 18 : print ( "you are an adult. "

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions